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 520F59FA38E for ; Thu, 11 May 2006 04:06:43 -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 59784-02-3 for ; Thu, 11 May 2006 04:06:34 -0300 (ADT) X-Greylist: delayed 00:18:49.399726 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id D3B0E9FADD1 for ; Thu, 11 May 2006 04:06:29 -0300 (ADT) Received: from mail.mnc.ch (62-2-77-205.business.cablecom.ch [62.2.77.205]) by svr4.postgresql.org (Postfix) with ESMTP id AE9C85B709D for ; Thu, 11 May 2006 06:46:38 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by mail.mnc.ch (Postfix) with ESMTP id BA1DBA82EC; Thu, 11 May 2006 08:47:05 +0200 (CEST) Received: from mail.mnc.ch ([127.0.0.1]) by localhost (mail.test.lan [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 28707-03; Thu, 11 May 2006 08:47:04 +0200 (CEST) Received: from meuh.mnc.lan (62-2-77-204.business.cablecom.ch [62.2.77.204]) by mail.mnc.ch (Postfix) with ESMTP id 637E7A82B2; Thu, 11 May 2006 08:47:04 +0200 (CEST) Received: by meuh.mnc.lan (Postfix, from userid 1000) id 67A64183437; Thu, 11 May 2006 08:46:31 +0200 (CEST) To: "Christian Paul Cosinas" Cc: Subject: Re: Speed Up Offset and Limit Clause References: <002801c67509$8f1a51a0$1e21100a@ghwk02002147> X-Hashcash: 1:20:060511:cpc@cybees.com::+JuTrmjoQL0yEe2Q:0004Iuw X-Hashcash: 1:20:060511:pgsql-performance@postgresql.org::YWxMJltO+IsWs3QY:000000000000000000000000000001aag From: Guillaume Cottenceau Date: 11 May 2006 08:46:31 +0200 In-Reply-To: <002801c67509$8f1a51a0$1e21100a@ghwk02002147> Message-ID: <87bqu5t5x4.fsf@meuh.mnc.lan> Lines: 22 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: amavisd-new at mnc.ch X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/288 X-Sequence-Number: 19075 "Christian Paul Cosinas" writes: > 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. First you should read the appropriate documentation. http://www.postgresql.org/docs/8.1/interactive/performance-tips.html -- Guillaume Cottenceau