Re: Practical Cursors - Mailing list pgsql-general

From Joe Conway
Subject Re: Practical Cursors
Date
Msg-id 021b01c13fc3$a3a29b80$6cdc10ac@jecw2k1
Whole thread Raw
In response to Practical Cursors  ("Command Prompt, Inc." <pgsql-general@commandprompt.com>)
Responses Re: Practical Cursors
List pgsql-general
> However, using something like PHP will not allow this because HTTP is
> stateless and PostgreSQL will not know from one transaction to the next
> that the results of the connection are related.
>
> Is this truly the case, or is there a way for PostgreSQL to remember the
> connection identifier so that the next time a PHP connection is made with
> the same identifier a transaction can be completed?
>
> Sincerely,
>
> Joshua Drake
>

I have actually been thinking recently about just this question. I looked
through the source for the PHP pgsql extension and it is clear that no
cursor is used. There is, however, the ability to open a persistent
connection to PostgreSQL from PHP. I think it would be possible to create a
persistent resource identifier to a cursor in a similar manner, and "reuse"
the cursor across multiple HTTP requests.

The downside I can see is that PHP would have no way to know when it could
garbage-collect the allocated resource. So while it could be done, what
would happen when the user closes their browser with your cursor still open?

-- Joe


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: [HACKERS] MySQL development MUST immdediately cease - Due to
Next
From: Martijn van Oosterhout
Date:
Subject: Re: What is faster?