pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedNot clear on what PQgetResult does
11+ messages / 6 participants
[nested] [flat]
* Not clear on what PQgetResult does
@ 2005-11-17 19:00 David Rysdam <drysdam@ll.mit.edu>
0 siblings, 2 replies; 11+ messages in thread
From: David Rysdam @ 2005-11-17 19:00 UTC (permalink / raw)
To: pgsql-interfaces
I don't understand in what sense PQgetResult is asynchronous. Obviously
PQsendQuery returns immediately and apparently PQgetResult() allows me
to get separate results from multiple queries submitted together, but...
Let's say I have a table with 1,000,000 rows and I PQsendQuery() a query
to get them all. When I call PQgetResult() the first time, will it
block until all 1,000,000 are ready, or will it send back everything
that's ready at the time I call it?
If the latter, is pgtcl's pg_getresult supposed to work the same way?
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Not clear on what PQgetResult does
@ 2005-11-17 19:38 Tom Lane <tgl@sss.pgh.pa.us>
parent: David Rysdam <drysdam@ll.mit.edu>
1 sibling, 1 reply; 11+ messages in thread
From: Tom Lane @ 2005-11-17 19:38 UTC (permalink / raw)
To: David Rysdam <drysdam@ll.mit.edu>; +Cc: pgsql-interfaces
David Rysdam <drysdam@ll.mit.edu> writes:
> I don't understand in what sense PQgetResult is asynchronous.
It isn't. You can use it in an asynchronous client, but the way you do
that is by not calling it until PQisBusy says you can (which means the
whole result has arrived, and you're just calling PQgetResult to get
hold of it).
> If the latter, is pgtcl's pg_getresult supposed to work the same way?
Dunno ... there was no such command last time I looked at pgtcl.
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Not clear on what PQgetResult does
@ 2005-11-17 20:01 David Rysdam <drysdam@ll.mit.edu>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 11+ messages in thread
From: David Rysdam @ 2005-11-17 20:01 UTC (permalink / raw)
To: ; +Cc: pgsql-interfaces
Tom Lane wrote:
>David Rysdam <drysdam@ll.mit.edu> writes:
>
>
>>I don't understand in what sense PQgetResult is asynchronous.
>>
>>
>
>It isn't. You can use it in an asynchronous client, but the way you do
>that is by not calling it until PQisBusy says you can (which means the
>whole result has arrived, and you're just calling PQgetResult to get
>hold of it).
>
So there's no way to have libpq return partial results before they are
all ready?
If I may, I would like to express some degree of incredulity. Even the
version of Sybase I'm using does this right and it's from 1997!
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Not clear on what PQgetResult does
@ 2005-11-17 20:14 Brett Schwarz <brett_schwarz@yahoo.com>
parent: David Rysdam <drysdam@ll.mit.edu>
1 sibling, 0 replies; 11+ messages in thread
From: Brett Schwarz @ 2005-11-17 20:14 UTC (permalink / raw)
To: David Rysdam <drysdam@ll.mit.edu>; pgsql-interfaces
>
> Let's say I have a table with 1,000,000 rows and I
> PQsendQuery() a query
> to get them all. When I call PQgetResult() the
> first time, will it
> block until all 1,000,000 are ready, or will it send
> back everything
> that's ready at the time I call it?
>
> If the latter, is pgtcl's pg_getresult supposed to
> work the same way?
>
pg_getresult really is just a wrapper around
PQgetResult, so it should behave the same.
See the README.async in pgtcl if you want more info on
async with pgtcl.
--brett
--brett
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Not clear on what PQgetResult does
@ 2005-11-17 20:40 Joshua D. Drake <jd@commandprompt.com>
parent: David Rysdam <drysdam@ll.mit.edu>
0 siblings, 1 reply; 11+ messages in thread
From: Joshua D. Drake @ 2005-11-17 20:40 UTC (permalink / raw)
To: David Rysdam <drysdam@ll.mit.edu>; +Cc: pgsql-interfaces
>
>>
>> It isn't. You can use it in an asynchronous client, but the way you do
>> that is by not calling it until PQisBusy says you can (which means the
>> whole result has arrived, and you're just calling PQgetResult to get
>> hold of it).
>>
> So there's no way to have libpq return partial results before they are
> all ready?
>
> If I may, I would like to express some degree of incredulity. Even
> the version of Sybase I'm using does this right and it's from 1997!
I am sure we would welcome a patch ;))
Sincerely,
Joshua D. Drake
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Not clear on what PQgetResult does
@ 2005-11-17 20:42 David Rysdam <drysdam@ll.mit.edu>
parent: Joshua D. Drake <jd@commandprompt.com>
0 siblings, 4 replies; 11+ messages in thread
From: David Rysdam @ 2005-11-17 20:42 UTC (permalink / raw)
To: ; +Cc: pgsql-interfaces
Joshua D. Drake wrote:
>>
>>>
>>> It isn't. You can use it in an asynchronous client, but the way you do
>>> that is by not calling it until PQisBusy says you can (which means the
>>> whole result has arrived, and you're just calling PQgetResult to get
>>> hold of it).
>>>
>> So there's no way to have libpq return partial results before they
>> are all ready?
>>
>> If I may, I would like to express some degree of incredulity. Even
>> the version of Sybase I'm using does this right and it's from 1997!
>
> I am sure we would welcome a patch ;))
To be honest, this is almost enough to drive me away from PG. But I
like everything else about it, so I could perhaps give a patch a whirl.
Or are there underlying server reasons why this won't work?
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Not clear on what PQgetResult does
@ 2005-11-17 21:16 Alvaro Herrera <alvherre@commandprompt.com>
parent: David Rysdam <drysdam@ll.mit.edu>
3 siblings, 1 reply; 11+ messages in thread
From: Alvaro Herrera @ 2005-11-17 21:16 UTC (permalink / raw)
To: David Rysdam <drysdam@ll.mit.edu>; +Cc: pgsql-interfaces
David Rysdam wrote:
> Joshua D. Drake wrote:
>
> >>>It isn't. You can use it in an asynchronous client, but the way you do
> >>>that is by not calling it until PQisBusy says you can (which means the
> >>>whole result has arrived, and you're just calling PQgetResult to get
> >>>hold of it).
> >>>
> >>So there's no way to have libpq return partial results before they
> >>are all ready?
> >>
> >>If I may, I would like to express some degree of incredulity. Even
> >>the version of Sybase I'm using does this right and it's from 1997!
> >
> >I am sure we would welcome a patch ;))
>
> To be honest, this is almost enough to drive me away from PG.
If you are in need of partial results you may as well use a cursor and
fetch from it, a bunch at a time.
> Or are there underlying server reasons why this won't work?
This topic was discussed four days ago I think ... look for a thread
with subject "Incremental results from libpq" on the archives of this
list.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Not clear on what PQgetResult does
@ 2005-11-17 21:39 Tom Lane <tgl@sss.pgh.pa.us>
parent: David Rysdam <drysdam@ll.mit.edu>
3 siblings, 0 replies; 11+ messages in thread
From: Tom Lane @ 2005-11-17 21:39 UTC (permalink / raw)
To: David Rysdam <drysdam@ll.mit.edu>; +Cc: pgsql-interfaces
David Rysdam <drysdam@ll.mit.edu> writes:
> To be honest, this is almost enough to drive me away from PG. But I
> like everything else about it, so I could perhaps give a patch a whirl.
> Or are there underlying server reasons why this won't work?
Have you bothered to read the preceding discussion you were pointed at?
http://archives.postgresql.org/pgsql-interfaces/2005-11/index.php
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Not clear on what PQgetResult does
@ 2005-11-17 21:40 Joshua D. Drake <jd@commandprompt.com>
parent: David Rysdam <drysdam@ll.mit.edu>
3 siblings, 0 replies; 11+ messages in thread
From: Joshua D. Drake @ 2005-11-17 21:40 UTC (permalink / raw)
To: David Rysdam <drysdam@ll.mit.edu>; +Cc: pgsql-interfaces
>
> To be honest, this is almost enough to drive me away from PG. But I
> like everything else about it, so I could perhaps give a patch a
> whirl. Or are there underlying server reasons why this won't work?
I thought (I could be wrong) that tom said that the support was in the
protocol but that libpq did not support it, so I would guess there is no
reason
except that there is no patch.
Sincerely,
Joshua D. Drake
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Not clear on what PQgetResult does
@ 2005-11-22 22:32 Bruce Momjian <pgman@candle.pha.pa.us>
parent: David Rysdam <drysdam@ll.mit.edu>
3 siblings, 0 replies; 11+ messages in thread
From: Bruce Momjian @ 2005-11-22 22:32 UTC (permalink / raw)
To: David Rysdam <drysdam@ll.mit.edu>; +Cc: pgsql-interfaces
David Rysdam wrote:
> Joshua D. Drake wrote:
>
> >>
> >>>
> >>> It isn't. You can use it in an asynchronous client, but the way you do
> >>> that is by not calling it until PQisBusy says you can (which means the
> >>> whole result has arrived, and you're just calling PQgetResult to get
> >>> hold of it).
> >>>
> >> So there's no way to have libpq return partial results before they
> >> are all ready?
> >>
> >> If I may, I would like to express some degree of incredulity. Even
> >> the version of Sybase I'm using does this right and it's from 1997!
> >
> > I am sure we would welcome a patch ;))
>
> To be honest, this is almost enough to drive me away from PG.
I think you should return to Sybase as soon as you can! :-)
Seriously, look at the current TODO list and the issues involved.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: Not clear on what PQgetResult does
@ 2005-11-22 22:33 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Alvaro Herrera <alvherre@commandprompt.com>
0 siblings, 0 replies; 11+ messages in thread
From: Bruce Momjian @ 2005-11-22 22:33 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@commandprompt.com>; +Cc: David Rysdam <drysdam@ll.mit.edu>; pgsql-interfaces
Alvaro Herrera wrote:
> David Rysdam wrote:
> > Joshua D. Drake wrote:
> >
> > >>>It isn't. You can use it in an asynchronous client, but the way you do
> > >>>that is by not calling it until PQisBusy says you can (which means the
> > >>>whole result has arrived, and you're just calling PQgetResult to get
> > >>>hold of it).
> > >>>
> > >>So there's no way to have libpq return partial results before they
> > >>are all ready?
> > >>
> > >>If I may, I would like to express some degree of incredulity. Even
> > >>the version of Sybase I'm using does this right and it's from 1997!
> > >
> > >I am sure we would welcome a patch ;))
> >
> > To be honest, this is almost enough to drive me away from PG.
>
> If you are in need of partial results you may as well use a cursor and
> fetch from it, a bunch at a time.
Right, this is the standard way.
> > Or are there underlying server reasons why this won't work?
>
> This topic was discussed four days ago I think ... look for a thread
> with subject "Incremental results from libpq" on the archives of this
> list.
That thread has already been condensed into a TODO entry.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2005-11-22 22:33 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-11-17 19:00 Not clear on what PQgetResult does David Rysdam <drysdam@ll.mit.edu>
2005-11-17 19:38 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-11-17 20:01 ` David Rysdam <drysdam@ll.mit.edu>
2005-11-17 20:40 ` Joshua D. Drake <jd@commandprompt.com>
2005-11-17 20:42 ` David Rysdam <drysdam@ll.mit.edu>
2005-11-17 21:16 ` Alvaro Herrera <alvherre@commandprompt.com>
2005-11-22 22:33 ` Bruce Momjian <pgman@candle.pha.pa.us>
2005-11-17 21:39 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-11-17 21:40 ` Joshua D. Drake <jd@commandprompt.com>
2005-11-22 22:32 ` Bruce Momjian <pgman@candle.pha.pa.us>
2005-11-17 20:14 ` Brett Schwarz <brett_schwarz@yahoo.com>
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