pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Volkan YAZICI <yazicivo@ttnet.net.tr>
To: Reed Loefgren <rloef@interfold.com>
Cc: pgsql-php@postgresql.org
Subject: Re: server dropping connection
Date: Wed, 3 May 2006 12:19:38 +0300
Message-ID: <20060503091937.GA205@alamut> (raw)
In-Reply-To: <20060502180351.K92645@auden.jmla.com>
References: <20060502180351.K92645@auden.jmla.com>

On May 02 06:13, Reed Loefgren wrote:
> I've been trying to run a nested query via a browser using a php script. 
> The script looks at a table with a couple years worth of data (6M rows). 
> If I constrain the search to five or six days of the data it works fine 
> and displays the result set in the browser, but if I have it parse the 
> entire table it errors out with this message:
> 
> server closed the connection unexpectedly This probably means the server 
> terminated abnormally before or while processing the request.

Just making rhetoric: You removed script execution time limits via
set_time_limit(), right?

I'll suggest turning error_reporting() to E_ALL and using asynchronous
query execution functions, instead of synchron ones. For instance:

$query_cmd = "SELECT ...";
$res = pg_send_query($conn, $query_cmd);
if (!$res)
{
    /* Error handling stuff... */
}

while (pg_connection_busy($conn))
{
    /*
     * Sorry, no clue about connection socket in here.
     * We're waiting without select() or poll().
     * (I know, I know... PHP sucks.)
     */
     usleep(100000); /* 0.1 seconds. */
}

/* Seems like result is ready now. */

$res = pg_get_result($conn);
if (!$res)
{
    /* Error handling. */
}

IMHO, this method can output more verbose (and accurate?) query status
when compared to an odd pg_query() call.


Regards.



view thread (3+ messages)

Message-ID: <20060503091937.GA205@alamut>
Permalink:  ../20060503091937.GA205@alamut/
Also on:    postgresql.org/message-id/20060503091937.GA205@alamut

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: yazicivo@ttnet.net.tr, rloef@interfold.com
  Subject: Re: server dropping connection
  In-Reply-To: <20060503091937.GA205@alamut>
  References: <20060502180351.K92645@auden.jmla.com> <20060503091937.GA205@alamut>

* 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