Re: Running a query twice to ensure cached results.

From: "Luke Lonergan" <llonergan(at)greenplum(dot)com>
To: "Ron Mayer" <rm_pg(at)cheapcomplexdevices(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Running a query twice to ensure cached results.
Date: 2006-06-13 11:54:05
Message-ID: C0B3F56D.26F8A%llonergan@greenplum.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ron,

On 6/8/06 11:49 AM, "Ron Mayer" <rm_pg(at)cheapcomplexdevices(dot)com> wrote:

> Experimental results here suggest that for larger tables Linux seems
> to detect a seq-scan and not bother caching. It's very reproducible
> for me here to do a reboot and not see the full speedup on a seq_scan
> until the third time I run a query.su

What you are seeing is the now infamous "Postgres writes a table one more
time after loading" behavior.

Simon Riggs once dug into it to find the root cause, and I no longer recall
exactly why, but after you've loaded data, the first seq scan will re-write
some large portion of the data while doing the initial scan. This wreaks
havoc on normal benchmarking practices.

Tom - can you explain what's going on with this? It seems to write more
than just the contents of the WAL, so it's not a flush of the WAL writes
AFAICT.

- Luke

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthew T. O'Connor 2006-06-13 12:15:47 Re: CSV mode option for pg_dump
Previous Message Martijn van Oosterhout 2006-06-13 08:31:08 Re: longjmp in psql considered harmful