Re: postgres session termination - Mailing list pgsql-general

From Ragnar Hafstað
Subject Re: postgres session termination
Date
Msg-id 1107164820.27081.19.camel@localhost.localdomain
Whole thread Raw
In response to postgres session termination  ("Rick Schumeyer" <rschumeyer@ieee.org>)
List pgsql-general
On Sun, 2005-01-30 at 21:24 -0500, 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?

in normal php context, the generation of each web page should
be considered a separate database session.

there is no garantee that the 'next page' request from the user gets
the same database connection, even if you use connection pooling.

you can use LIMIT and OFFSET to do what you want.

if your rows are ordered by a unique key, and you only
have to browse forward, you can do:
  SELECT * from table where key > ?
where the '?' is last value retrieved.

gnari



pgsql-general by date:

Previous
From: Troels Arvin
Date:
Subject: Re: Dynamic SQL
Next
From: Frans
Date:
Subject: Re: postgresql 7.4.6 slowing down