Unstable path in index regress test query
| От | Nikita Malakhov |
|---|---|
| Тема | Unstable path in index regress test query |
| Дата | |
| Msg-id | CAN-LCVOgBms6==prC48io0kw_muQfYerEbiYxNivqRCcLgL0qw@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: Unstable path in index regress test query
|
| Список | pgsql-hackers |
Hi hackers!
While doing some tests I've stumbled upon an unstable behavior of the query
explain
SELECT unique1 FROM tenk1
WHERE unique1 IN (1,42,7)
ORDER BY unique1;
SELECT unique1 FROM tenk1
WHERE unique1 IN (1,42,7)
ORDER BY unique1;
from create_index regress test.
This test could randomly return any of 2 paths (below is sequential run,
clean latest master install, without server restart or any other queries in-between):
postgres=# explain SELECT unique1 FROM tenk1
WHERE unique1 IN (1,42,7)
ORDER BY unique1;
QUERY PLAN
-------------------------------------------------------------------------------------
Sort (cost=310.65..311.02 rows=150 width=4)
Sort Key: unique1
-> Bitmap Heap Scan on tenk1 (cost=14.02..305.23 rows=150 width=4)
Recheck Cond: (unique1 = ANY ('{1,42,7}'::integer[]))
-> Bitmap Index Scan on tenk1_unique1 (cost=0.00..13.98 rows=150 width=0)
Index Cond: (unique1 = ANY ('{1,42,7}'::integer[]))
(6 rows)
postgres=# explain SELECT unique1 FROM tenk1
WHERE unique1 IN (1,42,7)
ORDER BY unique1;
QUERY PLAN
---------------------------------------------------------------------------------
Index Only Scan using tenk1_unique1 on tenk1 (cost=0.29..12.91 rows=3 width=4)
Index Cond: (unique1 = ANY ('{1,42,7}'::integer[]))
(2 rows)
WHERE unique1 IN (1,42,7)
ORDER BY unique1;
QUERY PLAN
-------------------------------------------------------------------------------------
Sort (cost=310.65..311.02 rows=150 width=4)
Sort Key: unique1
-> Bitmap Heap Scan on tenk1 (cost=14.02..305.23 rows=150 width=4)
Recheck Cond: (unique1 = ANY ('{1,42,7}'::integer[]))
-> Bitmap Index Scan on tenk1_unique1 (cost=0.00..13.98 rows=150 width=0)
Index Cond: (unique1 = ANY ('{1,42,7}'::integer[]))
(6 rows)
postgres=# explain SELECT unique1 FROM tenk1
WHERE unique1 IN (1,42,7)
ORDER BY unique1;
QUERY PLAN
---------------------------------------------------------------------------------
Index Only Scan using tenk1_unique1 on tenk1 (cost=0.29..12.91 rows=3 width=4)
Index Cond: (unique1 = ANY ('{1,42,7}'::integer[]))
(2 rows)
The strange thing is that paths are returned quite randomly, but the first more often than the second.
Is it a bug? Or some feature?
You could check the full log in attach.
Thanks!
--
Вложения
В списке pgsql-hackers по дате отправления: