Re: wat is the max number of rows that can be returned

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joel Burton <joel(at)joelburton(dot)com>
Cc: HK <harikrishnan(at)midascomm(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: wat is the max number of rows that can be returned
Date: 2002-12-04 16:55:46
Message-ID: 14937.1039020946@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Joel Burton <joel(at)joelburton(dot)com> writes:
> And you're wondering what will happen if you write a query that returns
> more than 2 billion rows (2000 million)?

The first thing that will happen is that you'll run out of memory in the
client process to store all those rows in your PGresult.

You can handle ridiculously-large query results by opening a cursor
and fetching reasonable-sized chunks with FETCH; it might take awhile
but in theory you could process an indefinitely large result that way.

I don't think the int-sized result of PGntuples is going to be a issue
in the foreseeable future --- platforms that could hold >2G tuples are
no doubt going to use a wider size of int.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Dmitri Touretsky 2002-12-04 17:31:49 Re: Rp. : Very slow performance
Previous Message Joel Burton 2002-12-04 15:28:32 Re: wat is the max number of rows that can be returned