Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 1C8182E0055 for ; Wed, 2 Apr 2008 07:13:14 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 32241-09 for ; Wed, 2 Apr 2008 07:13:07 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from fabaglexfr.fabasoft.com (fabaglexfr.fabasoft.com [192.84.221.196]) by developer.postgresql.org (Postfix) with ESMTP id C846A2E004A for ; Wed, 2 Apr 2008 07:13:06 -0300 (ADT) Received: from FABAMAIL.fabagl.fabasoft.com ([10.10.5.137]) by fabaglexfr.fabasoft.com with InterScan Messaging Security Suite; Wed, 02 Apr 2008 12:12:21 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Cursors and different settings for default_statistics_target x-mimeole: Produced By Microsoft Exchange V6.5 Date: Wed, 2 Apr 2008 12:11:06 +0200 Message-ID: In-Reply-To: <15688.1207088631@sss.pgh.pa.us> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Cursors and different settings for default_statistics_target Thread-Index: AciURsz45AtaIf+BQF68VqXqSJX+PgAYUusQ References: <2798.1207063805@sss.pgh.pa.us> <9629.1207066619@sss.pgh.pa.us> <9999.1207068123@sss.pgh.pa.us> <15688.1207088631@sss.pgh.pa.us> From: "Hell, Robert" To: "Tom Lane" Cc: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200804/19 X-Sequence-Number: 29512 I'm motivated to contribute a patch for that. I would prefer to make tuple_fraction for cursors configurable as GUC parameter cursor_tuple_fraction. Do you agree with that? Regards, Robert -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 Sent: Mittwoch, 02. April 2008 00:24 To: Hell, Robert Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Cursors and different settings for default_statistics_target=20 "Hell, Robert" 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 >=3D x AND objid <=3D 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