X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 211BF534B5 for ; Fri, 8 Apr 2005 17:54:29 +0100 (BST) 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 75676-10 for ; Fri, 8 Apr 2005 16:54:24 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 8E002531C7 for ; Fri, 8 Apr 2005 17:54:23 +0100 (BST) Received: from gnari ([157.157.159.208] [157.157.159.208]) by quasar.skima.is with ESMTP; Fri, 8 Apr 2005 16:54:21 Z Subject: Re: getting count for a specific querry From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: Tom Lane Cc: Joel Fradkin , pgsql-sql@postgresql.org In-Reply-To: <15084.1112977923@sss.pgh.pa.us> References: <000001c53c3e$f4f5b730$797ba8c0@jfradkin> <1112977546.7447.39.camel@localhost.localdomain> <15084.1112977923@sss.pgh.pa.us> Content-Type: text/plain Date: Fri, 08 Apr 2005 16:55:49 +0000 Message-Id: <1112979349.7447.42.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/102 X-Sequence-Number: 20995 On Fri, 2005-04-08 at 12:32 -0400, Tom Lane wrote: > Ragnar =?ISO-8859-1?Q?Hafsta=F0?= writes: > > you might reduce the performance loss if your dataset is ordered by > > a UNIQUE index. > > > select * from mytable where somecondition > > ORDER by uniquecol limit 50; > > > and next: > > > select * from mytable where somecondition AND uniquecol>? > > ORDER by uniquecol limit 50 OFFSET 50; > > > where the ? is placeholder for last value returned by last query. > > Uh, you don't want the OFFSET there do you? ooops! of course not. the uniquecol>? is meant to REPLACE the OFFSET. gnari