Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Gt0-0002vv-P1 for pgsql-php@arkaria.postgresql.org; Sun, 12 Jan 2014 08:59:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W2Gt0-0000AX-8v for pgsql-php@arkaria.postgresql.org; Sun, 12 Jan 2014 08:59:14 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Gsz-0000AQ-5L for pgsql-php@postgresql.org; Sun, 12 Jan 2014 08:59:13 +0000 Received: from [2404:130:0:10::40:2] (helo=mail.catalyst.net.nz) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W2Gsr-0001AI-Ea for pgsql-php@postgresql.org; Sun, 12 Jan 2014 08:59:12 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.catalyst.net.nz (Postfix) with ESMTP id 2DA6B32F69; Sun, 12 Jan 2014 21:59:02 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at catalyst.net.nz Received: from mail.catalyst.net.nz ([127.0.0.1]) by localhost (bertrand.catalyst.net.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U2Vl3NtuwkJI; Sun, 12 Jan 2014 21:59:01 +1300 (NZDT) Received: from [192.168.1.64] (122-60-64-230.jetstream.xtra.co.nz [122.60.64.230]) (Authenticated sender: mark.kirkwood) by mail.catalyst.net.nz (Postfix) with ESMTPSA id 62BF832F61; Sun, 12 Jan 2014 21:59:01 +1300 (NZDT) Message-ID: <52D25955.4050909@catalyst.net.nz> Date: Sun, 12 Jan 2014 21:59:01 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Eric Chamberlain , Andrew McMillan CC: "pgsql-php@postgresql.org" Subject: Re: Unbuffered queries References: <1389227496.5900.128.camel@narbon.home.mcmillan.net.nz>, <52CE20D5.5050700@catalyst.net.nz> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2404:130:0:10::40:2 (failed) X-Pg-Spam-Score: 0.8 (/) 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 On 09/01/14 18:33, Eric Chamberlain wrote: > Correct. I ended up limiting the number of records I query at a time. > I'm not sure how much of the thread has been e-mailed to you but I have > an example that shows the method in which I was able to query N number > of records every iteration. > Unfortunately I don't seem to have seen that message. However that reminds me that for completeness I should really show an example fetching >1 row at a time in PDO (pgbench schema again): $fetch_num = 100; $cursql = "DECLARE cur1 CURSOR FOR SELECT * FROM pgbench_accounts WHERE bid = ?"; $sql = "FETCH $fetch_num FROM cur1"; $dbh->beginTransaction(); $curstmt = $dbh->prepare($cursql); $curstmt->execute(array(rand(0, 100))); for (;;) { $stmt = $dbh->prepare($sql); $stmt->execute(); $rowarray = $stmt->fetchAll(PDO::FETCH_ASSOC); if ($rowarray) { foreach ($rowarray as $row) { print "... " . $row['aid'] . " " . $row['bid'] . "\n"; } } else { break; } } Regards Mark -- Sent via pgsql-php mailing list (pgsql-php@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-php