X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D53389FA15C for ; Thu, 11 May 2006 03:51:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 49970-02 for ; Thu, 11 May 2006 03:51:40 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.196]) by postgresql.org (Postfix) with ESMTP id 932BA9FA29F for ; Thu, 11 May 2006 03:51:40 -0300 (ADT) Received: by nz-out-0102.google.com with SMTP id k1so106628nzf for ; Wed, 10 May 2006 23:51:39 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=TMEdDudz7h+2K/qMNvbvJlvA2bwiy15WBENpTrXiXv6YcD8T1apXa7bgF68ad49FGJtIJjYNUAlK8RMcHWi+l197WeYHUefyNTRWikc/dq0DDx2qXtqw7HW32WtliuKjZonyV04KXggtQ2lvKnrzVF2eW1OocqnQzQL8NvQnrxw= Received: by 10.36.247.53 with SMTP id u53mr361050nzh; Wed, 10 May 2006 23:51:39 -0700 (PDT) Received: from ?10.1.1.21? ( [203.217.18.65]) by mx.gmail.com with ESMTP id 39sm819076nzk.2006.05.10.23.51.37; Wed, 10 May 2006 23:51:38 -0700 (PDT) Message-ID: <4462DEF8.7060805@gmail.com> Date: Thu, 11 May 2006 16:51:36 +1000 From: Chris User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christian Paul Cosinas CC: pgsql-performance@postgresql.org Subject: Re: Speed Up Offset and Limit Clause References: <002801c67509$8f1a51a0$1e21100a@ghwk02002147> In-Reply-To: <002801c67509$8f1a51a0$1e21100a@ghwk02002147> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/286 X-Sequence-Number: 19073 Christian Paul Cosinas wrote: > Hi! > > How can I speed up my server's performance when I use offset and limit > clause. > > For example I have a query: > SELECT * FROM table ORDER BY id, name OFFSET 100000 LIMIT 10000 > > This query takes a long time about more than 2 minutes. > > If my query is: > SELECT * FROM table ORDER BY id, name OFFSET 50000 LIMIT 10000 > It takes about 2 seconds. Please create a new thread rather than replying to someone elses post and changing the subject. These threads can sometimes get missed. You do have an index on id and name don't you? -- Postgresql & php tutorials http://www.designmagick.com/