Skip site navigation (1) Skip section navigation (2)

Re: Takes too long to fetch the data from database

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "soni de" <soni(dot)de(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Takes too long to fetch the data from database
Date: 2006-04-20 16:05:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
> SELECT * FROM wan ORDER BY stime LIMIT 50 OFFSET 81900;

you need to try and solve the problem without using 'offset'.  you could do:
DECLARE crs cursor FOR SELECT * FROM wan ORDER BY stime;
FETCH ABSOLUTE 81900 in crs;
FETCH 49 in crs;
CLOSE crs;

this may be a bit faster but will not solve the fundamental problem.

the more interesting question is why you want to query exactly 81900
rows into a set.  This type of thinking will always get you into
trouble, absolute positioning will not really work in a true sql
sense.  if you are browsing a table sequentially, there are much
better methods.


In response to


pgsql-performance by date

Next:From: Radovan AntlogaDate: 2006-04-20 16:10:21
Subject: Re: Performance decrease
Previous:From: Tom LaneDate: 2006-04-20 15:41:41
Subject: Re: Performance decrease

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group