From: Craig Ringer <craig@postnewspapers.com.au>
To: Carlo Stonebanks <stonec.register@sympatico.ca>
Cc: pgsql-performance@postgresql.org
Subject: Re: Function scan/Index scan to nested loop
Date: Tue, 11 May 2010 15:14:08 +0800
Message-ID: <4BE903C0.4020203@postnewspapers.com.au> (raw)
In-Reply-To: <hsaq4t$c3s$1@news.hub.org>
References: <hsaq4t$c3s$1@news.hub.org>
On 11/05/10 13:32, Carlo Stonebanks wrote:
> Hello all,
>
> A query ran twice in succession performs VERY poorly the first time as
> it iterates through the nested loop. The second time, it rips. Please
> see SQL, SLOW PLAN and FAST PLAN below.
I haven't looked at the details, but the comment you made about it being
fast on the live server which hits this query frequently tends to
suggest that this is a caching issue.
Most likely, the first time Pg has to read the data from disk. The
second time, it's in memory-based disk cache or even in Pg's
shared_buffers, so it can be accessed vastly quicker.
--
Craig Ringer
Tech-related writing: http://soapyfrogs.blogspot.com/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: craig@postnewspapers.com.au, stonec.register@sympatico.ca
Subject: Re: Function scan/Index scan to nested loop
In-Reply-To: <4BE903C0.4020203@postnewspapers.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox