Tomas Vondra <tomas.vondra@enterprisedb.com> writes:
> Yeah. I think it's good to design the data/queries in such a way that
> the behavior does not flip due to minor noise like in this case.
+1
> But I'm a bit confused - how come the estimates do change at all? The
> analyze simply fetches 30k rows, and tenk only has 10k of them. So we
> should have *exact* numbers, and it should be exactly the same for all
> the analyze runs. So how come it changes like this?
It's plausible that the VACUUM ANALYZE done by test_setup fails
ConditionalLockBufferForCleanup() sometimes because of concurrent
activity like checkpointer writes. I'm not quite sure how we
get from that to the observed symptom though. Maybe the
VACUUM needs DISABLE_PAGE_SKIPPING?
regards, tom lane