Commit 422774b4 authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-10683: main.order_by_optimizer_innodb fails in buildbot

Fix order_by_optimizer_innodb and order_by_innodb tests.

The problem was that the query could be ran before InnoDB was
ready to provide a realistic statistic for #records in the table.

It provided a number that was too low, which caused the optimizer
to decide that range access plan wasn't advantageous and discard it.
parent e4ce61ac
......@@ -159,6 +159,12 @@ insert into t2 values
(1,2,'2019-03-05 00:00:00','2019-03-06 00:00:00'),
(2,3,'2019-03-05 00:00:00','2019-03-06 00:00:00'),
(3,3,'2019-03-06 00:00:00','2019-03-05 00:00:00');
analyze table t1,t2 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
select
t1.id,t2.id
from
......@@ -177,6 +183,10 @@ id id
2 1
3 3
create index for_latest_sort on t2 (d1 desc, d2 desc, id desc);
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
select
t1.id,t2.id
from
......
......@@ -148,6 +148,7 @@ insert into t2 values
(2,3,'2019-03-05 00:00:00','2019-03-06 00:00:00'),
(3,3,'2019-03-06 00:00:00','2019-03-05 00:00:00');
analyze table t1,t2 persistent for all;
select
t1.id,t2.id
from
......@@ -163,6 +164,7 @@ from
);
create index for_latest_sort on t2 (d1 desc, d2 desc, id desc);
analyze table t2 persistent for all;
select
t1.id,t2.id
......
......@@ -24,6 +24,10 @@ REPEAT('filler-data-', 10),
REPEAT('filler-data-', 10)
from
t1;
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
select pk1, count(*) from t2 group by pk1;
pk1 count(*)
0 1
......
......@@ -33,6 +33,7 @@ select
from
t1;
analyze table t2 persistent for all;
select pk1, count(*) from t2 group by pk1;
--echo # The following should use range(ux_pk1_fd5), two key parts (key_len=5+8=13)
......
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