Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W0zCK-0004ib-IM for pgsql-php@arkaria.postgresql.org; Wed, 08 Jan 2014 19:53:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W0zCK-0004V2-2q for pgsql-php@arkaria.postgresql.org; Wed, 08 Jan 2014 19:53:52 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W0zCI-0004Uw-GR for pgsql-php@postgresql.org; Wed, 08 Jan 2014 19:53:51 +0000 Received: from blu0-omc4-s14.blu0.hotmail.com ([65.55.111.153]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W0zCF-0000Iz-D6 for pgsql-php@postgresql.org; Wed, 08 Jan 2014 19:53:49 +0000 Received: from BLU168-W6 ([65.55.111.137]) by blu0-omc4-s14.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 8 Jan 2014 11:53:46 -0800 X-TMN: [z2qqSsaH/fPx36RaJQAmmWBexr/2moj9] X-Originating-Email: [eric.chamberlain@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="_d4ca0d48-413d-47c8-8ba9-f2680f47c198_" From: Eric Chamberlain To: "pgsql-php@postgresql.org" Subject: Unbuffered queries Date: Wed, 8 Jan 2014 13:53:46 -0600 Importance: Normal MIME-Version: 1.0 X-OriginalArrivalTime: 08 Jan 2014 19:53:46.0985 (UTC) FILETIME=[57D98D90:01CF0CAB] X-Pg-Spam-Score: 0.7 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-php Precedence: bulk Sender: pgsql-php-owner@postgresql.org --_d4ca0d48-413d-47c8-8ba9-f2680f47c198_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable When using php_query()=2C is this buffering all of the results from the que= ry into memory? If so=2C is there a parameter I can send to make it not buf= fer the query? I've also seen comments suggesting that a cursor should be u= sed. There doesn't seem to be any way to get access to the internal cursor = used by the PHP pgsql libs... or are they referring to doing something like= this: $result =3D pg_query($conn=2C "BEGIN=3B DECLARE s CURSOR FOR SELECT * FROM = users=3B FETCH ALL IN s=3B END=3B")=3B And then after which I could do this: while ($row =3D pg_fetch_assoc($result)) { ...} I don't have a large enough result set in my development or QA environment = to run this query within PHP to know if it works or not. Any suggestions wo= uld be helpful. Thank you! Eric Chamberlain = --_d4ca0d48-413d-47c8-8ba9-f2680f47c198_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
When using php_query()=2C is thi= s buffering all of the results from the query into memory? If so=2C is ther= e a parameter I can send to make it not buffer the query? I've also seen co= mments suggesting that a cursor should be used. There doesn't seem to be an= y way to get access to the internal cursor used by the PHP pgsql libs... or= are they referring to doing something like this:

$result =3D pg_query($conn=2C "BEGIN=3B DECLARE s CURS= OR FOR SELECT * FROM users=3B FETCH ALL IN s=3B END=3B")=3B
=
And then after which I could do this:

while ($row =3D pg_fetch_assoc($result)) {
 =3B  =3B ...
}

I = don't have a large enough result set in my development or QA environment to= run this query within PHP to know if it works or not. Any suggestions woul= d be helpful. Thank you!

Eric Chamberlain
=
= --_d4ca0d48-413d-47c8-8ba9-f2680f47c198_--