Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> writes:
> Does running a query only twice really insure that a result is cached?
> It seems not to be the case for seq-scans on Linux.
Should work for tables small enough to fit into the shared_buffers
arena. I wouldn't necessarily assume it for large tables.
Note that what I was really doing was taking the timing measurement
again on data cached by the *first* run, so that I would have something
that could fairly be compared to the following EXPLAIN ANALYZE --- which
of course would likewise be operating on cached data.
regards, tom lane