X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id EA1099FB282 for ; Wed, 3 May 2006 07:24:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 59981-01-7 for ; Wed, 3 May 2006 07:23:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from fep03.ttnet.net.tr (mail.ttnet.net.tr [212.175.13.129]) by postgresql.org (Postfix) with ESMTP id CFD519FB2BB for ; Wed, 3 May 2006 06:22:03 -0300 (ADT) Received: from (192.168.8.103) by AVGW-I-1.ttnet.net.tr via smtp id 0f4e_f5a52384_da5b_11da_83ea_001422175f0e; Wed, 03 May 2006 07:19:06 +0300 Received: from alamut ([85.102.236.143]) by fep03.ttnet.net.tr with ESMTP id <20060503092201.LZEH23475.fep03.ttnet.net.tr@alamut>; Wed, 3 May 2006 12:22:01 +0300 Date: Wed, 3 May 2006 12:19:38 +0300 From: Volkan YAZICI To: Reed Loefgren Cc: pgsql-php@postgresql.org Subject: Re: server dropping connection Message-ID: <20060503091937.GA205@alamut> References: <20060502180351.K92645@auden.jmla.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060502180351.K92645@auden.jmla.com> User-Agent: Mutt/1.4.2.1i X-NAI-Spam-Rules: 1 Rules triggered BAYES_00=-2.5 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/4 X-Sequence-Number: 3504 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.