Re: Takes too long to fetch the data from database - Mailing list pgsql-performance

From Merlin Moncure
Subject Re: Takes too long to fetch the data from database
Date
Msg-id b42b73150604200905h56a0d387xec8c80b4c8d3e901@mail.gmail.com
Whole thread Raw
In response to Re: Takes too long to fetch the data from database  ("soni de" <soni.de@gmail.com>)
Responses Re: Takes too long to fetch the data from database
List 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:
BEGIN;
DECLARE crs cursor FOR SELECT * FROM wan ORDER BY stime;
FETCH ABSOLUTE 81900 in crs;
FETCH 49 in crs;
CLOSE crs;
COMMIT;

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.

merlin

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Performance decrease
Next
From: "Radovan Antloga"
Date:
Subject: Re: Performance decrease