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 8491F528A5 for ; Tue, 17 May 2005 15:43:49 -0300 (ADT) 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 85018-07 for ; Tue, 17 May 2005 18:43:39 +0000 (GMT) Received: from cougar.unisys.com.br (smtp2.unisys.com.br [200.220.0.118]) by svr1.postgresql.org (Postfix) with ESMTP id CDA645280C for ; Tue, 17 May 2005 15:43:37 -0300 (ADT) Received: from [192.168.0.1] ([200.155.197.32]) by cougar.unisys.com.br ; Tue, 17 May 2005 15:43:36 -0300 EST Message-ID: <428A3B54.4070902@pobox.com> Date: Tue, 17 May 2005 15:43:32 -0300 From: Alain User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: pt-br, pt MIME-Version: 1.0 To: Sql-Postgre Subject: Re: Does Postgresql have a similar pseudo-column "ROWNUM" as References: <20050517170636.GC12405@phlogiston.dyndns.org> <428A2E81.2060501@pobox.com> <1116353539.26520.5.camel@localhost.localdomain> In-Reply-To: <1116353539.26520.5.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Rcpt-To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200505/140 X-Sequence-Number: 21453 >>> >>>No. What is the purpose of your query? You could use ORDER BY and >>>LIMIT..OFFSET to do what you want. I think. >> >>The problem is probably speed. I have done a lot of tests, and when >>OFFSET gets to a few thousands on a multimega-recs database, it gets >>very very slow... > > > is there not a similar loss of speed using ROWNUM on oracle? > > >>... Is there any other to work around that? > > > if you are ordering by a unique key, you can use the key value > in a WHERE clause. > > select ... where ukey>? order by ukey limit 100 offset 100; > > (the ? is placeholder for the last value of ukey returned > from previous select) I tried that. It does not work in the generic case: 6 MegaRec, telephone listing, alphabetical order. The problem is that somewhere there is a single user with too many entries (over 1000). I even tried to filter the repetitions, but somewhere I get stuck if one guy has too mny entries (one for each phone number). I tried using both the name and the primary key (with a combined index), to get faster to the record I want, but I was not sucessfull in building a where clause. I would appreciate any help, in fact this is my primary reason for joining this list ;-) Alain