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 D07489FA3B3 for ; Tue, 16 May 2006 22:41:40 -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 64190-02 for ; Tue, 16 May 2006 22:41:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailer.eglobalreach.net (mail.opm.ph [202.124.128.22]) by postgresql.org (Postfix) with ESMTP id F3EEE9F9C18 for ; Tue, 16 May 2006 22:41:34 -0300 (ADT) Received: from ghwk02002147 (mailer.eglobalreach.net [127.0.0.1]) by mailer.eglobalreach.net (8.11.6p2/) with ESMTP id k4H1fQX25843; Wed, 17 May 2006 09:41:27 +0800 From: "Christian Paul Cosinas" To: "'PFC'" , Subject: Re: Speed Up Offset and Limit Clause Date: Wed, 17 May 2006 09:51:05 -0000 Message-ID: <00e101c67997$6aa049f0$1e21100a@ghwk02002147> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 thread-index: AcZ0yShMlJrIPbLSSXqR9TwwF2XbVgEzfEWw X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/353 X-Sequence-Number: 19140 I am creating an application that gets the value of a large table and write it to a file. Why I want to use offset and limit is for me to create a threaded application so that they will not get the same results. For example: Thread 1 : gets offset 0 limit 5000 Thread 2 : gets offset 5000 limit 5000 Thread 3 : gets offset 10000 limit 5000 And so on... Would there be any other faster way than what It thought? -----Original Message----- From: PFC [mailto:lists@peufeu.com] Sent: Thursday, May 11, 2006 7:06 AM To: Christian Paul Cosinas; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Speed Up Offset and Limit Clause Why do you want to use it this way ? Explain what you want to do, there probably is another faster solution... On Thu, 11 May 2006 16:45:33 +0200, 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. > > Thanks > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match