X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BD6838BA0F2 for ; Fri, 11 Feb 2005 19:41:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22470-03 for ; Fri, 11 Feb 2005 19:40:38 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4D7318BA0A2 for ; Fri, 11 Feb 2005 19:40:38 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1BJePFh013009; Fri, 11 Feb 2005 14:40:25 -0500 (EST) To: "Joost Kraaijeveld" Cc: "Richard Huxton" , "Pgsql-Performance (E-mail)" Subject: Re: How to interpret this explain analyse? In-reply-to: References: Comments: In-reply-to "Joost Kraaijeveld" message dated "Fri, 11 Feb 2005 20:25:11 +0100" Date: Fri, 11 Feb 2005 14:40:25 -0500 Message-ID: <13008.1108150825@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/193 X-Sequence-Number: 10522 "Joost Kraaijeveld" writes: > I cannot change the query (it is geneated by a tool called Clarion) but it something like (from the psqlodbc_xxx.log): > "... > declare SQL_CUR01 cursor for > SELECT A.ordernummer, B.klantnummer FROM "orders" A LEFT OUTER JOIN "klt_alg" B ON A.Klantnummer=B.Klantnummer ORDER BY A.klantnummer; > fetch 100 in SQL_CUR01; > ..." Well, the planner does put some emphasis on startup time when dealing with a DECLARE CURSOR plan; the problem you face is just that that correction isn't large enough. (From memory, I think it optimizes on the assumption that 10% of the estimated rows will actually be fetched; you evidently want a setting of 1% or even less.) We once talked about setting up a GUC variable to control the percentage of a cursor that is estimated to be fetched: http://archives.postgresql.org/pgsql-hackers/2000-10/msg01108.php It never got done but that seems like the most reasonable solution to me. regards, tom lane