Re: Takes too long to fetch the data from database

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: soni de <soni(dot)de(at)gmail(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Takes too long to fetch the data from database
Date: 2006-04-21 17:41:49
Message-ID: 20060421174149.GA13275@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Apr 21, 2006 at 10:12:24 +0530,
soni de <soni(dot)de(at)gmail(dot)com> wrote:
> I don't want to query exactly 81900 rows into set. I just want to fetch 50
> or 100 rows at a time in a decreasing order of stime.(i.e 50 or 100 rows
> starting from last to end).

You can do this efficiently, if stime has an index and you can deal with using
stime from the previous query instead of the record count. The idea is to
select up 50 or 100 records in descending order where the stime is <=
the previous stime. This can give you some overlapping records, so you need
some way to deal with this.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2006-04-21 18:19:27 Re: Takes too long to fetch the data from database
Previous Message Alvaro Herrera 2006-04-21 16:38:29 Re: Inactive memory Grows unlimited