Re: Trouble with conections between php and postgre

From: "Daniel Walters" <daniel(dot)walters(at)hitwise(dot)com>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Re: Trouble with conections between php and postgre
Date: 2005-10-04 02:37:53
Message-ID: 20051004023647.1DF9713A28D@kyle.sinewave.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Hi John,

I have some clarification on your suggestion...

This function is specifically for asynchronous queries though - if Luis is
not using asynchronous queries the mileage may vary. The other issue is that
even if the query can be cancelled how does Luis accurately determine when
to do this?

To detect a closed or stopped/cancelled browser (see the notes in the php
manual under connection_status();) the script actually needs to poll the
client (this can be done by flushing a single character in a loop down to
the browser - this is ugly for a lot of fairly obvious reasons).

I think the key to issue is the session locking (as per my previous post).

There is quite a history to this issue (browsing the archives of this list
and Usenet reveals this) and it is in fact the reason why I am on this list.

The issue has also been raised as bugs at http://bugs.php.net but have been
systematically closed without fixes since as early as 2001.

Requests have been made for the addition of functions to pause a session
(remove the file lock while a query is running because you know the session
wont be written to during this time) and then restart the session (once the
query has completed).

This type of functionality can be somewhat achieved with
session_write_close() except that this function unfortunately sends a cookie
header automatically and this causes issues for IE if done repeatedly.

I have made some suggestions in my previous post (which is being moderated
currently) which may help but they are certainly not clean solutions.
Hopefully someone will take notice (this time) of this thread and work on
making php deal with this better.

Regards,

Daniel Walters.

-----Original Message-----
From: pgsql-php-owner(at)postgresql(dot)org [mailto:pgsql-php-owner(at)postgresql(dot)org]
On Behalf Of John DeSoi
Sent: Tuesday, October 04, 2005 11:17 AM
To: luis linietsky
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: [PHP] Trouble with conections between php and postgre

On Oct 3, 2005, at 9:59 AM, luis linietsky wrote:

> Hi !, first of all: sorry about my english, i'm not from us.
> I 'm using latest versions of postgre 7.4 with php4 and apache2, on a
> debian system. I'm working with a really big database, so there are
> many querys that takes too much time to be executed (And there's
> nothig to do about it). These querys blocks the php page while's being
> loaded. The problem is that usually, one excepcts to stop those querys
> or even close the conection if the user stops the explorer or closes
> the window. However, this isn't hapening, the query keeps running in
> the database, using resources.
> I already try uselessly ignore_user_abort(False), and I don't want to
> set a time limit.
> ¿Any ideas? ¿Am I missing something ?

There is a specific protocol for canceling a query in progress. Maybe this
PHP function will work for you:

http://www.php.net/manual/en/function.pg-cancel-query.php

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Toon van Doorn 2005-10-04 11:55:16 Query takes much to long, is there a work around?
Previous Message John DeSoi 2005-10-04 01:17:15 Re: Trouble with conections between php and postgre