Re: large resultset

From: Marco Dieckhoff <marco(dot)dieckhoff(at)googlemail(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: large resultset
Date: 2010-06-15 09:49:57
Message-ID: 4C174CC5.5080708@googlemail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Am 15.06.2010 11:40, schrieb vinny:
> On Tue, 15 Jun 2010 10:33:05 +0100, Thom Brown<thombrown(at)gmail(dot)com>
> wrote:
>
>> On 15 June 2010 09:31, AI Rumman wrote:
>> How to return large resutlset (almost 2 millions record) in php?
>>
>>
>> Obviously that wouldn't do by itself, but it's quite simple to loop over
>> a result set.
>>
> 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.
>

huh?

Returning one large record containg the information of two million
records will almost certainly fill up your memory.
First the memory of the sql server, in order to process the combination
of two million records, and if that's even successfull, the memory of
the server processing php.

Looping may take "a little" longer, but as only one row at a time is
fetched, it should be the least possible memory use.

In most cases, you don't want to process every two million datasets in
php anyway.
You may want to aggregate the data or maybe use created functions on the
sql server.

regards,
Marco

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message AI Rumman 2010-06-15 10:01:17 Re: large resultset
Previous Message Thom Brown 2010-06-15 09:43:35 Re: large resultset