Speed Up Offset and Limit Clause

From: "Christian Paul Cosinas" <cpc(at)cybees(dot)com>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Speed Up Offset and Limit Clause
Date: 2006-05-11 14:45:33
Message-ID: 002801c67509$8f1a51a0$1e21100a@ghwk02002147
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Qingqing Zhou 2006-05-11 15:26:12 Re: Postgres gets stuck
Previous Message Ketema Harris 2006-05-11 12:57:48 Nested Loops vs. Hash Joins or Merge Joins