X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9CBF5DA00F for ; Wed, 19 Oct 2005 04:30:33 -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 62728-06 for ; Wed, 19 Oct 2005 07:30:29 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 8D35AD9F71 for ; Wed, 19 Oct 2005 04:30:30 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 3BA594130CE; Wed, 19 Oct 2005 08:30:24 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 9FE7C15ED5; Wed, 19 Oct 2005 08:26:07 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21724-05; Wed, 19 Oct 2005 08:26:03 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 89F8915EDA; Wed, 19 Oct 2005 08:25:50 +0100 (BST) Message-ID: <4355F4FD.5080006@archonet.com> Date: Wed, 19 Oct 2005 08:25:49 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Landin Hostbaek Cc: PostgresSQL list Subject: Re: Double query (limit and offset) References: <20051011151105.GA29943@mich2.itxmarket.com> In-Reply-To: <20051011151105.GA29943@mich2.itxmarket.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.059 required=5 tests=[AWL=0.009, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/214 X-Sequence-Number: 23067 Michael Landin Hostbaek wrote: > List, > > I'm using the OFFSET / LIMIT combo in order to split up my query, so it > only parses 20 rows at a time (for my php-scripted webpage). The best way to do it is to have a layer between your application and the database that can cache the results of your query. Unfortunately PHP is not ideal for this - you might want to google for "php memcache" and "pgmemcache" though. Once you can cache the query, you run it once, use the row-count and then fetch the rows from cache. -- Richard Huxton Archonet Ltd