Commit e98a5e16 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-23955 main.multi_update_big times out

Copying generated data from the sequence engine should be faster
than copying from MyISAM to MyISAM.

Reviewed by: Sergei Petrunia
parent 4a97e25a
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ; CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
# The protocolling of many inserts into t1 is suppressed. INSERT INTO t1 SELECT seq,seq FROM seq_1_to_2097152;
ALTER TABLE t1 ADD INDEX i1(a); ALTER TABLE t1 ADD INDEX i1(a);
DELETE FROM t1 WHERE a > 2000000; DELETE FROM t1 WHERE a > 2000000;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
......
...@@ -3,27 +3,7 @@ set @save_max_heap_table_size=@@max_heap_table_size; ...@@ -3,27 +3,7 @@ set @save_max_heap_table_size=@@max_heap_table_size;
set storage_engine=MYISAM; set storage_engine=MYISAM;
CREATE TABLE t1 (id INTEGER); CREATE TABLE t1 (id INTEGER);
CREATE TABLE t2 (id INTEGER); CREATE TABLE t2 (id INTEGER);
INSERT INTO t1 (id) VALUES (1), (1), (1),(1); INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_1_to_1024 b;
INSERT INTO t1 (id) SELECT id FROM t1;
/* 8 */
INSERT INTO t1 (id) SELECT id FROM t1;
/* 12 */
INSERT INTO t1 (id) SELECT id FROM t1;
/* 16 */
INSERT INTO t1 (id) SELECT id FROM t1;
/* 20 */
INSERT INTO t1 (id) SELECT id FROM t1;
/* 24 */
INSERT INTO t1 SELECT id+1 FROM t1;
INSERT INTO t1 SELECT id+2 FROM t1;
INSERT INTO t1 SELECT id+4 FROM t1;
INSERT INTO t1 SELECT id+8 FROM t1;
INSERT INTO t1 SELECT id+16 FROM t1;
INSERT INTO t1 SELECT id+32 FROM t1;
INSERT INTO t1 SELECT id+64 FROM t1;
INSERT INTO t1 SELECT id+128 FROM t1;
INSERT INTO t1 SELECT id+256 FROM t1;
INSERT INTO t1 SELECT id+512 FROM t1;
SELECT AVG(DISTINCT id) FROM t1 GROUP BY id % 13; SELECT AVG(DISTINCT id) FROM t1 GROUP BY id % 13;
AVG(DISTINCT id) AVG(DISTINCT id)
513.5000 513.5000
...@@ -54,11 +34,9 @@ SUM(DISTINCT id)/COUNT(DISTINCT id) ...@@ -54,11 +34,9 @@ SUM(DISTINCT id)/COUNT(DISTINCT id)
517.0000 517.0000
511.5000 511.5000
512.5000 512.5000
INSERT INTO t1 SELECT id+1024 FROM t1; INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_1025_to_16384 b;
INSERT INTO t1 SELECT id+2048 FROM t1; INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a,seq_1_to_16384 b
INSERT INTO t1 SELECT id+4096 FROM t1; ORDER by (a.seq*0+b.seq)*rand();
INSERT INTO t1 SELECT id+8192 FROM t1;
INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
SELECT SUM(DISTINCT id) sm FROM t1; SELECT SUM(DISTINCT id) sm FROM t1;
sm sm
134225920 134225920
...@@ -110,9 +88,10 @@ sm ...@@ -110,9 +88,10 @@ sm
# (bug #56927) # (bug #56927)
# #
SET max_heap_table_size=default; SET max_heap_table_size=default;
INSERT INTO t1 SELECT id+16384 FROM t1; INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_16385_to_32768 b;
DELETE FROM t2; TRUNCATE t2;
INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand(); INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a,seq_1_to_32768 b
ORDER BY (a.seq*0+b.seq)*rand();
SELECT SUM(DISTINCT id) sm FROM t2; SELECT SUM(DISTINCT id) sm FROM t2;
sm sm
536887296 536887296
......
--source include/long_test.inc --source include/long_test.inc
--source include/have_sequence.inc
# #
# Test of update statement that uses many tables. # Test of update statement that uses many tables.
...@@ -40,25 +41,9 @@ if (`SELECT '$BIG_TEST' = '' AND $need_big = 1`) ...@@ -40,25 +41,9 @@ if (`SELECT '$BIG_TEST' = '' AND $need_big = 1`)
# Bug#1820 Rows not deleted from second table on multi-table delete # Bug#1820 Rows not deleted from second table on multi-table delete
# #
--disable_warnings
DROP TABLE IF EXISTS t1,t2;
--enable_warnings
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ; CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
--echo # The protocolling of many inserts into t1 is suppressed. INSERT INTO t1 SELECT seq,seq FROM seq_1_to_2097152;
--disable_query_log
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
let $1=19;
set @d=4;
begin;
while ($1)
{
eval INSERT INTO t1 SELECT a+@d,b+@d FROM t1;
eval SET @d=@d*2;
dec $1;
}
commit;
--enable_query_log
ALTER TABLE t1 ADD INDEX i1(a); ALTER TABLE t1 ADD INDEX i1(a);
DELETE FROM t1 WHERE a > 2000000; DELETE FROM t1 WHERE a > 2000000;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
......
...@@ -19,32 +19,15 @@ set storage_engine=MYISAM; ...@@ -19,32 +19,15 @@ set storage_engine=MYISAM;
CREATE TABLE t1 (id INTEGER); CREATE TABLE t1 (id INTEGER);
CREATE TABLE t2 (id INTEGER); CREATE TABLE t2 (id INTEGER);
INSERT INTO t1 (id) VALUES (1), (1), (1),(1); INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_1_to_1024 b;
INSERT INTO t1 (id) SELECT id FROM t1; /* 8 */
INSERT INTO t1 (id) SELECT id FROM t1; /* 12 */
INSERT INTO t1 (id) SELECT id FROM t1; /* 16 */
INSERT INTO t1 (id) SELECT id FROM t1; /* 20 */
INSERT INTO t1 (id) SELECT id FROM t1; /* 24 */
INSERT INTO t1 SELECT id+1 FROM t1;
INSERT INTO t1 SELECT id+2 FROM t1;
INSERT INTO t1 SELECT id+4 FROM t1;
INSERT INTO t1 SELECT id+8 FROM t1;
INSERT INTO t1 SELECT id+16 FROM t1;
INSERT INTO t1 SELECT id+32 FROM t1;
INSERT INTO t1 SELECT id+64 FROM t1;
INSERT INTO t1 SELECT id+128 FROM t1;
INSERT INTO t1 SELECT id+256 FROM t1;
INSERT INTO t1 SELECT id+512 FROM t1;
# Just test that AVG(DISTINCT) is there # Just test that AVG(DISTINCT) is there
SELECT AVG(DISTINCT id) FROM t1 GROUP BY id % 13; SELECT AVG(DISTINCT id) FROM t1 GROUP BY id % 13;
SELECT SUM(DISTINCT id)/COUNT(DISTINCT id) FROM t1 GROUP BY id % 13; SELECT SUM(DISTINCT id)/COUNT(DISTINCT id) FROM t1 GROUP BY id % 13;
INSERT INTO t1 SELECT id+1024 FROM t1; INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_1025_to_16384 b;
INSERT INTO t1 SELECT id+2048 FROM t1; INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a,seq_1_to_16384 b
INSERT INTO t1 SELECT id+4096 FROM t1; ORDER by (a.seq*0+b.seq)*rand();
INSERT INTO t1 SELECT id+8192 FROM t1;
INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
# SELECT '++++++++++++++++++++++++++++++++++++++++++++++++++'; # SELECT '++++++++++++++++++++++++++++++++++++++++++++++++++';
...@@ -74,9 +57,10 @@ SELECT SUM(DISTINCT id) sm FROM t1 GROUP BY id % 13; ...@@ -74,9 +57,10 @@ SELECT SUM(DISTINCT id) sm FROM t1 GROUP BY id % 13;
SET max_heap_table_size=default; SET max_heap_table_size=default;
INSERT INTO t1 SELECT id+16384 FROM t1; INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_16385_to_32768 b;
DELETE FROM t2; TRUNCATE t2;
INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand(); INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a,seq_1_to_32768 b
ORDER BY (a.seq*0+b.seq)*rand();
SELECT SUM(DISTINCT id) sm FROM t2; SELECT SUM(DISTINCT id) sm FROM t2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment