Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 7BEAC632EAF for ; Tue, 15 Jun 2010 06:33:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 87773-02 for ; Tue, 15 Jun 2010 09:33:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ww0-f46.google.com (mail-ww0-f46.google.com [74.125.82.46]) by mail.postgresql.org (Postfix) with ESMTP id 1241A632D7B for ; Tue, 15 Jun 2010 06:33:28 -0300 (ADT) Received: by wwb18 with SMTP id 18so4578999wwb.19 for ; Tue, 15 Jun 2010 02:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=JZC6UWi9MdVu0dVE4C7xwOFW8um6UGObjBI4irIGZMo=; b=EvHRUcjrxVl2d7k/G1mZJ6921RYCcCjtJZEcoAutJHczkGoFKnPIj9QnjXNmEU7GVI QgcwFZlypFlSnc9nNV8VYyMBfzCO2+cZgHg8bUu6OVkm4il4BklaLFCsEFWnLPIw+c10 QQsYlPZwcPBmSZHEwARg5vVOcnGtTYvw+XgX4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=stnpnRDvl2RgLIddCpF0rcnW3fHAZDr7etSz9XzCysdVqtuBDYGjvw6vktYwycJtgi f9yNzfNeqFhc6eFuMlXexUIqL5FEg3j6EWTRSn81MFubK1EfYFvzU3uL7LU7YcpaZTHL Z5BNakPZKfB+vYlhJGFWI9QKzZDeg+ScFS2Y0= Received: by 10.216.86.19 with SMTP id v19mr3365462wee.89.1276594405235; Tue, 15 Jun 2010 02:33:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.188.209 with HTTP; Tue, 15 Jun 2010 02:33:05 -0700 (PDT) In-Reply-To: References: From: Thom Brown Date: Tue, 15 Jun 2010 10:33:05 +0100 Message-ID: Subject: Re: large resultset To: AI Rumman Cc: pgsql-php@postgresql.org Content-Type: multipart/alternative; boundary=0016e6d99bfe0bdd8704890e4cfc X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201006/2 X-Sequence-Number: 4141 --0016e6d99bfe0bdd8704890e4cfc Content-Type: text/plain; charset=ISO-8859-1 On 15 June 2010 09:31, AI Rumman wrote: > How to return large resutlset (almost 2 millions record) in php? > Presumably this is so people can download results rather than display them in a browser? Here's a basic a raw version of what you can do: $db = pg_connect($connection_string); $results = pg_query($db, $query); while ($result = pg_fetch_array($results) { echo implode("|", $result) . "\n"; } pg_close($db); Obviously that wouldn't do by itself, but it's quite simple to loop over a result set. Regards Thom --0016e6d99bfe0bdd8704890e4cfc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 15 June 2010 09:31, AI Rumman <rummandba@gmail.com> wrote:
How to return large resutlset (almost 2 millions record) in php?

Presumably this is so people can download results ra= ther than display them in a browser?

Here's a basic a raw versio= n of what you can do:

$db =3D pg_connect($connection_string);

$results =3D pg_query($db, $query);

while ($result =3D pg_fetch_= array($results)
{
=A0=A0=A0 echo implode("|", $result) . &q= uot;\n";
}

pg_close($db);

Obviously that wouldn't= do by itself, but it's quite simple to loop over a result set.

Regards

Thom
--0016e6d99bfe0bdd8704890e4cfc--