Re: Running a query twice to ensure cached results.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Running a query twice to ensure cached results.
Date: 2006-06-08 19:15:31
Message-ID: 29989.1149794131@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-06-08 19:18:36 Re: [PATCHES] drop if exists remainder
Previous Message Tom Lane 2006-06-08 19:08:39 Re: ADD/DROP INHERITS