Re: Function scan/Index scan to nested loop - Mailing list pgsql-performance

From Craig Ringer
Subject Re: Function scan/Index scan to nested loop
Date
Msg-id 4BE903C0.4020203@postnewspapers.com.au
Whole thread Raw
In response to Function scan/Index scan to nested loop  ("Carlo Stonebanks" <stonec.register@sympatico.ca>)
List pgsql-performance
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/

pgsql-performance by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Function scan/Index scan to nested loop
Next
From: "Carlo Stonebanks"
Date:
Subject: Re: Function scan/Index scan to nested loop