Re: Takes too long to fetch the data from database

Поиск
Список
Период
Сортировка
От soni de
Тема Re: Takes too long to fetch the data from database
Дата
Msg-id 9f2e40a90604202142x5adbe6f0r7a993f8319619cc7@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Takes too long to fetch the data from database  ("Merlin Moncure" <mmoncure@gmail.com>)
Ответы Re: Takes too long to fetch the data from database  ("Dave Dutcher" <dave@tridecap.com>)
Re: Takes too long to fetch the data from database  ("Merlin Moncure" <mmoncure@gmail.com>)
Re: Takes too long to fetch the data from database  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-performance
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).
 
if we fetched sequentially, there is also problem in fetching all the records (select * from wan where kname='pluto' order by stime) it is taking more than 4~5 minutes. tried it on same table having more than 326054 records.

 
On 4/20/06, Merlin Moncure <mmoncure@gmail.com> wrote:
> 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 по дате отправления:

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: Introducing a new linux readahead framework
Следующее
От: "Milen Kulev"
Дата:
Сообщение: Re: Quick Performance Poll