mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
7032486889
Added optimzation for clustered index Fixed bug in UPDATE ... ORDER BY Fixed handling of UPDATE ... LIMIT BitKeeper/deleted/.del-.cvsignore~7e29af89a3559f4c: Delete: Images/.cvsignore BitKeeper/deleted/.del-README~d5a4e7ca3a2e87a9: Delete: repl-tests/README BitKeeper/deleted/.del-run-all-tests~4deb6479a13e4568: Delete: repl-tests/run-all-tests BitKeeper/deleted/.del-run.test~3dc5b9bd1e9feea5: Delete: repl-tests/test-repl-alter/run.test BitKeeper/deleted/.del-run.test~4020771cff278f14: Delete: repl-tests/test-bad-query/run.test BitKeeper/deleted/.del-run.test~452f2b66537404a8: Delete: repl-tests/test-dump/run.test BitKeeper/deleted/.del-run.test~b1f0c1f96554df8: Delete: repl-tests/test-auto-inc/run.test BitKeeper/deleted/.del-table-dump-check.master~e13afeb8c79264b5: Delete: repl-tests/test-dump/table-dump-check.master BitKeeper/deleted/.del-table-dump-select.master~744acb955e33f3db: Delete: repl-tests/test-dump/table-dump-select.master BitKeeper/deleted/.del-x.master~29a93ed7956c8693: Delete: repl-tests/test-auto-inc/x.master BitKeeper/deleted/.del-x.master~3b248cbac9abda2b: Delete: repl-tests/test-bad-query/x.master BitKeeper/deleted/.del-foo-dump-master.master~b49ae6bec1e918ee: Delete: repl-tests/test-repl/foo-dump-master.master BitKeeper/deleted/.del-foo-dump-slave.master~f16ed20457d59be9: Delete: repl-tests/test-repl/foo-dump-slave.master BitKeeper/deleted/.del-repl-timestamp.master.reject~3492d2b74b413771: Delete: repl-tests/test-repl-ts/repl-timestamp.master.reject BitKeeper/deleted/.del-repl-timestamp.master~4b7782da5cc13161: Delete: repl-tests/test-repl-ts/repl-timestamp.master BitKeeper/deleted/.del-run.test~a1e32ea1e4253af4: Delete: repl-tests/test-repl/run.test BitKeeper/deleted/.del-run.test~ce5e626c91b760ec: Delete: repl-tests/test-repl-ts/run.test BitKeeper/deleted/.del-sum-wlen-master.master~1a5ea625c79e978: Delete: repl-tests/test-repl/sum-wlen-master.master BitKeeper/deleted/.del-sum-wlen-slave.master~f016d98833433084: Delete: repl-tests/test-repl/sum-wlen-slave.master BitKeeper/deleted/.del-test.master~5829e7b3770179db: Delete: repl-tests/test-repl-alter/test.master BitKeeper/deleted/.del-master-slave.inc~6775f6ae10137c39: Delete: repl-tests/include/master-slave.inc include/my_global.h: Fix for purify/valgrind myisam/mi_info.c: Updated comment mysql-test/r/group_by.result: New test results mysql-test/r/innodb.result: New test results mysql-test/r/join_outer.result: New test results mysql-test/r/multi_update.result: New test results mysql-test/r/null_key.result: New test results mysql-test/r/update.result: New test results mysql-test/t/group_by.test: Added extra explain to 'suspicious' test. mysql-test/t/innodb.test: Added test for UPDATE ... ORDER BY mysql-test/t/join_outer.test: Changed test to be repeatable mysql-test/t/multi_update.test: Slight change of test to catch more bugs mysql-test/t/update.test: Better test for UPDATE ... ORDER BY sql/field.cc: Simple optimization sql/ha_heap.h: Added optimzation for clustered index sql/ha_innodb.cc: Added optimzation for clustered index sql/ha_innodb.h: Added optimzation for clustered index sql/handler.h: Added optimzation for clustered index sql/item_sum.cc: Removed some usage of current_thd sql/mysqld.cc: Fix bug when compiling for purify/valgrind sql/opt_range.cc: Added optimzation for clustered index sql/records.cc: Fixed comment sql/sql_list.h: Fixed comment sql/sql_select.cc: Removed some usage of current_thd sql/sql_select.h: Removed some usage of current_thd sql/sql_union.cc: Removed some usage of current_thd sql/sql_update.cc: Fixed bug in UPDATE ... ORDER BY Fixed handling of UPDATE ... LIMIT support-files/my-huge.cnf.sh: Added default size for query cache support-files/my-large.cnf.sh: Added default size for query cache
140 lines
3.2 KiB
Text
140 lines
3.2 KiB
Text
drop table if exists t1;
|
|
create table t1 (a int auto_increment , primary key (a));
|
|
insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
|
update t1 set a=a+10 where a > 34;
|
|
update t1 set a=a+100 where a > 0;
|
|
update t1 set a=a+100 where a=1 and a=2;
|
|
update t1 set a=b+100 where a=1 and a=2;
|
|
Unknown column 'b' in 'field list'
|
|
update t1 set a=b+100 where c=1 and a=2;
|
|
Unknown column 'c' in 'where clause'
|
|
update t1 set d=a+100 where a=1;
|
|
Unknown column 'd' in 'field list'
|
|
select * from t1;
|
|
a
|
|
101
|
|
102
|
|
103
|
|
104
|
|
105
|
|
106
|
|
107
|
|
108
|
|
109
|
|
110
|
|
111
|
|
112
|
|
113
|
|
114
|
|
115
|
|
116
|
|
117
|
|
118
|
|
119
|
|
120
|
|
121
|
|
122
|
|
123
|
|
124
|
|
125
|
|
126
|
|
127
|
|
128
|
|
129
|
|
130
|
|
131
|
|
132
|
|
133
|
|
134
|
|
145
|
|
146
|
|
drop table t1;
|
|
CREATE TABLE t1
|
|
(
|
|
place_id int (10) unsigned NOT NULL,
|
|
shows int(10) unsigned DEFAULT '0' NOT NULL,
|
|
ishows int(10) unsigned DEFAULT '0' NOT NULL,
|
|
ushows int(10) unsigned DEFAULT '0' NOT NULL,
|
|
clicks int(10) unsigned DEFAULT '0' NOT NULL,
|
|
iclicks int(10) unsigned DEFAULT '0' NOT NULL,
|
|
uclicks int(10) unsigned DEFAULT '0' NOT NULL,
|
|
ts timestamp(14),
|
|
PRIMARY KEY (place_id,ts)
|
|
);
|
|
INSERT INTO t1 (place_id,shows,ishows,ushows,clicks,iclicks,uclicks,ts)
|
|
VALUES (1,0,0,0,0,0,0,20000928174434);
|
|
UPDATE t1 SET shows=shows+1,ishows=ishows+1,ushows=ushows+1,clicks=clicks+1,iclicks=iclicks+1,uclicks=uclicks+1 WHERE place_id=1 AND ts>="2000-09-28 00:00:00";
|
|
select place_id,shows from t1;
|
|
place_id shows
|
|
1 1
|
|
drop table t1;
|
|
CREATE TABLE t1 (
|
|
lfdnr int(10) unsigned NOT NULL default '0',
|
|
ticket int(10) unsigned NOT NULL default '0',
|
|
client varchar(255) NOT NULL default '',
|
|
replyto varchar(255) NOT NULL default '',
|
|
subject varchar(100) NOT NULL default '',
|
|
timestamp int(10) unsigned NOT NULL default '0',
|
|
tstamp timestamp(14) NOT NULL,
|
|
status int(3) NOT NULL default '0',
|
|
type varchar(15) NOT NULL default '',
|
|
assignment int(10) unsigned NOT NULL default '0',
|
|
fupcount int(4) unsigned NOT NULL default '0',
|
|
parent int(10) unsigned NOT NULL default '0',
|
|
activity int(10) unsigned NOT NULL default '0',
|
|
priority tinyint(1) unsigned NOT NULL default '1',
|
|
cc varchar(255) NOT NULL default '',
|
|
bcc varchar(255) NOT NULL default '',
|
|
body text NOT NULL,
|
|
comment text,
|
|
header text,
|
|
PRIMARY KEY (lfdnr),
|
|
KEY k1 (timestamp),
|
|
KEY k2 (type),
|
|
KEY k3 (parent),
|
|
KEY k4 (assignment),
|
|
KEY ticket (ticket)
|
|
) TYPE=MyISAM;
|
|
INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','','');
|
|
alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment;
|
|
update t1 set status=1 where type='Open';
|
|
select status from t1;
|
|
status
|
|
1
|
|
drop table t1;
|
|
create table t1 (a int not null, b int not null, key (a));
|
|
insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
|
|
SET @tmp=0;
|
|
update t1 set b=(@tmp:=@tmp+1) order by a;
|
|
update t1 set b=99 where a=1 order by b asc limit 1;
|
|
select * from t1 order by a,b;
|
|
a b
|
|
1 2
|
|
1 3
|
|
1 99
|
|
2 4
|
|
2 5
|
|
2 6
|
|
3 7
|
|
3 8
|
|
3 9
|
|
3 10
|
|
3 11
|
|
3 12
|
|
update t1 set b=100 where a=1 order by b desc limit 2;
|
|
update t1 set a=a+10+b where a=1 order by b;
|
|
select * from t1 order by a,b;
|
|
a b
|
|
2 4
|
|
2 5
|
|
2 6
|
|
3 7
|
|
3 8
|
|
3 9
|
|
3 10
|
|
3 11
|
|
3 12
|
|
13 2
|
|
111 100
|
|
111 100
|
|
drop table t1;
|