Re: Speed Up Offset and Limit Clause

From: "Christian Paul Cosinas" <cpc(at)cybees(dot)com>
To: "'PFC'" <lists(at)peufeu(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Speed Up Offset and Limit Clause
Date: 2006-05-17 09:51:05
Message-ID: 00e101c67997$6aa049f0$1e21100a@ghwk02002147
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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(at)peufeu(dot)com]
Sent: Thursday, May 11, 2006 7:06 AM
To: Christian Paul Cosinas; pgsql-performance(at)postgresql(dot)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
<cpc(at)cybees(dot)com> 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jignesh K. Shah 2006-05-17 11:07:53 Re: Pgsql (and mysql) benchmark on T2000/Solaris and some
Previous Message kah_hang_ang 2006-05-17 06:13:46 Performance incorporate with JReport