X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id BBD1CD1B54C for ; Fri, 3 Oct 2003 10:11:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 08824-10 for ; Fri, 3 Oct 2003 07:10:28 -0300 (ADT) Received: from anchor-post-37.mail.demon.net (anchor-post-37.mail.demon.net [194.217.242.87]) by svr1.postgresql.org (Postfix) with ESMTP id 7B79ED1B51A for ; Fri, 3 Oct 2003 07:10:25 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-37.mail.demon.net with esmtp (Exim 3.35 #1) id 1A5MtH-0004w2-0b; Fri, 03 Oct 2003 11:10:27 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 4A31C17183; Fri, 3 Oct 2003 11:10:26 +0100 (BST) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9F1FE1717B; Fri, 3 Oct 2003 11:10:25 +0100 (BST) From: Richard Huxton To: shyamperi@davlin.co.in, pgsql-performance@postgresql.org Subject: Re: A Basic Question Date: Fri, 3 Oct 2003 11:10:25 +0100 User-Agent: KMail/1.5 References: <6681508.1065164977817.JavaMail.tomcat@mail.davlin.co.in> In-Reply-To: <6681508.1065164977817.JavaMail.tomcat@mail.davlin.co.in> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310031110.25776.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/82 X-Sequence-Number: 3830 On Friday 03 October 2003 07:34, shyamperi@davlin.co.in wrote: > 12:28p > Dear All, > This question is regarding the performance of queries in general. > The performance of the queries wud varying depending on the no. Of tuples > it is returning, and the sort of alogorithm that will be implemented or the > retrieval. Now if the relation returns zero tuples.. (the seq, and the > index scan is the best option) and if there are 1 or more then rest > PG-supported scans will be the best. Now here is where I am having a bit of > considerations. My relation works fast, when it returns more than on tuple. > But get's slow when it returns zero tuple. Now how shud I got abt it. If PG has to examine a lot of tuples to rule them out, then returning no rows can take longer. If you post EXPLAIN ANALYSE output for both queries, someone will be able to explain why in your case. -- Richard Huxton Archonet Ltd