From: Thom Brown <thombrown@gmail.com>
To: vinny <vinny@xs4all.nl>
Cc: AI Rumman <rummandba@gmail.com>
Cc: pgsql-php@postgresql.org
Subject: Re: large resultset
Date: Tue, 15 Jun 2010 10:43:35 +0100
Message-ID: <AANLkTimJPh6X78KS0rflYhLcldMtrIq8S4HfMVMKUJfS@mail.gmail.com> (raw)
In-Reply-To: <8f468dc246fb6075f2a1f46b09f71a6d@xs4all.nl>
References: <AANLkTinXSz6PsoTyPhryAHsN3V-M0v-m3sTCLTJSJttO@mail.gmail.com>
<AANLkTimP7qSASY3dRA09p6e35CzRLo8pOyZ6J5_5Bisx@mail.gmail.com>
<8f468dc246fb6075f2a1f46b09f71a6d@xs4all.nl>
On 15 June 2010 10:40, vinny <vinny@xs4all.nl> wrote:
>
> On Tue, 15 Jun 2010 10:33:05 +0100, Thom Brown <thombrown@gmail.com>
> wrote:
> > 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"; //typo before
> > }
> >
> > pg_close($db);
> >
> > Obviously that wouldn't do by itself, but it's quite simple to loop over
> > a result set.
> >
> > Regards
> >
> > Thom
> >
>
> If that's the case surely you'd use some SQL to merge the data into one
> long string and return it in a single record.
> Looping over two million results is going to take a while, not to mention
> quite a bit of memory.
> v.
>
>
I don't understand. Return all data as a single massive string?
Thom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: thombrown@gmail.com, vinny@xs4all.nl, rummandba@gmail.com
Subject: Re: large resultset
In-Reply-To: <AANLkTimJPh6X78KS0rflYhLcldMtrIq8S4HfMVMKUJfS@mail.gmail.com>
References: <AANLkTinXSz6PsoTyPhryAHsN3V-M0v-m3sTCLTJSJttO@mail.gmail.com> <AANLkTimP7qSASY3dRA09p6e35CzRLo8pOyZ6J5_5Bisx@mail.gmail.com> <8f468dc246fb6075f2a1f46b09f71a6d@xs4all.nl> <AANLkTimJPh6X78KS0rflYhLcldMtrIq8S4HfMVMKUJfS@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox