Nikita Malakhov <[email protected]> writes:
> 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;

> from create_index regress test.

I wouldn't call what you're showing here an instability.
You create and populate the table, but your test script
isn't giving autovacuum any time to catch up, so the
first EXPLAIN is based on default behaviors without stats.
Then when you do an ANALYZE, the plan changes because the
rowcount estimates change.

You probably should make that a VACUUM ANALYZE, actually,
to ensure that the whole table is marked all-visible.
That can affect the estimated cost of an index-only scan too.

                        regards, tom lane


Reply via email to