Re: Cursors and different settings for default_statistics_target - Mailing list pgsql-performance

From Tom Lane
Subject Re: Cursors and different settings for default_statistics_target
Date
Msg-id 15688.1207088631@sss.pgh.pa.us
Whole thread Raw
In response to Re: Cursors and different settings for default_statistics_target  ("Hell, Robert" <Robert.Hell@fabasoft.com>)
Responses Re: Cursors and different settings for default_statistics_target  ("Hell, Robert" <Robert.Hell@fabasoft.com>)
List pgsql-performance
"Hell, Robert" <Robert.Hell@fabasoft.com> writes:
> But why are the first 15 fetches (15360 rows) processed in 0.5 seconds and the last fetch (998 rows) takes 7 seconds.
> Are we just unlucky that the last fetch takes that long?

Well, the indexscan plan is going to scan through all the rows in objid
order and return whichever of them happen to match the IN list.  So I
think you're just saying that your IN list isn't uniformly dense through
the whole set of objids.

If the real story is that you tend to select only objids within a narrow
range, adding explicit "AND objid >= x AND objid <= y" constraints
(where you compute x and y on the fly from the set of objids you're
asking for) would reduce the overhead of the indexscan.

            regards, tom lane

pgsql-performance by date:

Previous
From: "Hell, Robert"
Date:
Subject: Re: Cursors and different settings for default_statistics_target
Next
From: James Mansion
Date:
Subject: SSDs