From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Carmen Wai <wai_carmen(at)hotmail(dot)com> |
Cc: | kleptog(at)svana(dot)org, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Bulk row fetching |
Date: | 2002-08-15 15:42:51 |
Message-ID: | 3D5BCBFB.10205@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Carmen Wai wrote:
>
> I want to implement a similar mechanism as bulk row fetching in MFC ODBC
> classes for postgresql. For the very large record sets, it can fetch the
> first (let say) 100 records. After that, it can automatically fetch the
> next 100 records WITHOUT executing the SQL statement again, it will save
> lots of memory resouce / time.
>
> I only find that postgresql support : select * from table_name limit N
> offset M, but if I do it in this way, the DB need multiple execution
> which will take up lots of time.
>
> Do anyone gets any idea?
It always helps to start with the manual ;-)
See:
http://www.postgresql.org/idocs/index.php?libpq-example.html
for an example which uses a cursor. Instead of "FETCH ALL in mycursor",
you can do something like "FETCH 100 in mycursor". See:
http://www.postgresql.org/idocs/index.php?sql-fetch.html
for more on FETCH. See:
http://www.postgresql.org/idocs/index.php?sql-declare.html
for more on declaring a cursor.
HTH,
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Rice | 2002-08-15 15:47:30 | Re: Perl modules problem on OS X |
Previous Message | Tom Lane | 2002-08-15 15:40:55 | Re: how to synchronize database operations? |