X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1B2F19DD446 for ; Tue, 6 Dec 2005 06:32:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82532-08 for ; Tue, 6 Dec 2005 06:32:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from service-web.de (p15093784.pureserver.info [217.160.106.224]) by postgresql.org (Postfix) with ESMTP id D5C299DD441 for ; Tue, 6 Dec 2005 06:32:36 -0400 (AST) Received: from [10.100.1.50] (074-016-066-080.eggenet.de [80.66.16.74]) by service-web.de (Postfix) with ESMTP id E46F9200034; Tue, 6 Dec 2005 11:32:38 +0100 (CET) Message-ID: <439568C4.8050601@wildenhain.de> Date: Tue, 06 Dec 2005 11:32:36 +0100 From: Tino Wildenhain User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050929) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Joost Kraaijeveld Cc: Csaba Nagy , Pgsql-Performance Subject: Re: Can this query go faster??? References: <1133862229.8837.61.camel@Panoramix> <1133862777.4779.185.camel@coppola.muc.ecircle.de> <1133864460.8837.69.camel@Panoramix> In-Reply-To: <1133864460.8837.69.camel@Panoramix> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/155 X-Sequence-Number: 15976 Joost Kraaijeveld schrieb: > On Tue, 2005-12-06 at 10:52 +0100, Csaba Nagy wrote: > >>Joost, >> >>Why do you use an offset here ? I guess you're traversing the table >>somehow, in this case it would be better to remember the last zipcode + >>housenumber and put an additional condition to get the next bigger than >>the last one you've got... that would go for the index on >>zipcode+housenumber and be very fast. The big offset forces postgres to >>traverse that many entries until it's able to pick the one row for the > > I am forced to translate a sorting dependent record number to a record > in the database. The GUI (a Java JTable) works with record /row numbers, > which is handy if one has an ISAM database, but not if one uses > PostgreSQL. You can have a row number in postgres easily too. For example if you just include a serial for the row number. Cursor would work too but you would need to have a persistent connection. Regards Tino