pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Merlin Moncure <mmoncure@gmail.com>
To: soni de <soni.de@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Takes too long to fetch the data from database
Date: Thu, 20 Apr 2006 12:05:02 -0400
Message-ID: <b42b73150604200905h56a0d387xec8c80b4c8d3e901@mail.gmail.com> (raw)
In-Reply-To: <9f2e40a90604192237i5d3e8f0dl1c8b19887bc34e22@mail.gmail.com>
References: <9f2e40a90604100021n1cb694d0lb95f318f800f33ee@mail.gmail.com>
	<b42b73150604100845w553dcee6kde20e4b82770aab0@mail.gmail.com>
	<9f2e40a90604110004u787716c2s22bdf53fe349326@mail.gmail.com>
	<b42b73150604110613h2c63ea61oec8035c8e2f4ed98@mail.gmail.com>
	<9f2e40a90604192237i5d3e8f0dl1c8b19887bc34e22@mail.gmail.com>

> 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



view thread (17+ messages)  latest in thread

Message-ID: <b42b73150604200905h56a0d387xec8c80b4c8d3e901@mail.gmail.com>
Permalink:  ../b42b73150604200905h56a0d387xec8c80b4c8d3e901@mail.gmail.com/
Also on:    postgresql.org/message-id/b42b73150604200905h56a0d387xec8c80b4c8d3e901@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mmoncure@gmail.com, soni.de@gmail.com
  Subject: Re: Takes too long to fetch the data from database
  In-Reply-To: <b42b73150604200905h56a0d387xec8c80b4c8d3e901@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox