Unbuffered queries

From: Eric Chamberlain <eric(dot)chamberlain(at)hotmail(dot)com>
To: "pgsql-php(at)postgresql(dot)org" <pgsql-php(at)postgresql(dot)org>
Subject: Unbuffered queries
Date: 2014-01-08 19:53:46
Message-ID: BLU168-W6E6F9F54342A13F29A86484B10@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

When using php_query(), is this buffering all of the results from the query into memory? If so, is there a parameter I can send to make it not buffer the query? I've also seen comments suggesting that a cursor should be used. 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 = pg_query($conn, "BEGIN; DECLARE s CURSOR FOR SELECT * FROM users; FETCH ALL IN s; END;");

And then after which I could do this:
while ($row = 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 would be helpful. Thank you!
Eric Chamberlain

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Andrew McMillan 2014-01-09 00:31:36 Re: Unbuffered queries
Previous Message Andreas Kretschmer 2013-12-31 08:22:57 Re: Fwd: Web Hosting support for pgsql in PHP