Re: postgres session termination

From: Paul Tillotson <pntil(at)shentel(dot)net>
To: Rick Schumeyer <rschumeyer(at)ieee(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: postgres session termination
Date: 2005-01-31 06:15:52
Message-ID: 41FDCD18.6070104@shentel.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

IF you use pg_pconnect(), never close your script, and this page always
shows the same data to all users, then the temp table would work,
although it is not necessarily quicker than selecting ALL the rows
(i.e., don't bother with a temp table at all; just run the whole select
every time.)

The usual method for handling this is the LIMIT and OFFSET clauses in a
SELECT.

For example, this would get the results to put on the fifth page:

SELECT * FROM products ORDER BY stock_number DESC LIMIT 10 OFFSET 40;

Paul Tillotson

Rick Schumeyer wrote:

> I think this is a common task, but I’m not sure how to do it.
>
> I want to run a query that can return many records, display them
>
> 10 at a time, and be able to go forward/backward in the list. I’m
>
> not concerned about the list changing after the initial query.
>
> I’m accessing this via a php web page. I’m thinking that maybe
>
> the best way to do this, other than re-running the query each time,
>
> is to put the results into a temporary table. I think this will work
>
> if I never call “disconnect” from the php script. My question is,
>
> when does my Postgres session end? Is there a timeout?
>
> Of course, if this is a really bad way to do this, I’m willing to
>
> learn a better way!
>
> Thanks!
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Frans 2005-01-31 06:20:39 Re: postgresql 7.4.6 slowing down
Previous Message Michael Fuhr 2005-01-31 05:13:49 Re: postgresql 7.4.6 slowing down