Re: [INTERFACES] psqlodbc

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Hartwig <daybee(at)bellatlantic(dot)net>
Cc: Postgres Interfaces Mailing List <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: Re: [INTERFACES] psqlodbc
Date: 1998-08-02 19:33:37
Message-ID: 21375.902086417@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

David Hartwig <daybee(at)bellatlantic(dot)net> writes:
> We did not (and still do not) like the
> way libpq consumes the entire query result into front-end memory before
> returning control to the application. This make large queries slow and
> sometimes impossible.

With the new PQsendQuery/PQgetResult API, it would not take very much
work to address this objection. The application could set a limit on
the number of tuples to be returned per PGresult (maybe about 100 would
reasonable), and then use a loop calling PQgetResult to fetch all the
tuples of a large query. We'd probably want to add a new boolean flag
"end of query/not end of query" to PGresult so that one could use this
feature even when sending multiple SELECTs in one sendQuery.

Rather than make the limit a persistent setting of a PGconn object,
I'd be inclined to add it as a parameter to PQgetResult (I think it's
not too late to change the calling sequence for PQgetResult, since it
hasn't yet seen the light of day in any formal release). Otherwise
PQexec might start behaving unexpectedly in an application that contains
a mixture of old-style PQexec calls and new-style PQsendQuery/getResult.

If the memory consumption issue is a hot button for anyone who is using
(or would use) libpq, I'll see if I can squeeze this in for 6.4. I assume
the psqlodbc guys will stick to their own code anyway.

regards, tom lane

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Graff 1998-08-02 19:54:57 Re: [PATCHES] Re: [HACKERS] User authentication bug?
Previous Message David Hartwig 1998-08-02 17:08:47 Re: [INTERFACES] psqlodbc