pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCursors
2+ messages / 2 participants
[nested] [flat]
* Cursors
@ 1998-09-23 15:55 Glenn Sullivan <glenn.sullivan@nmr.varian.com>
0 siblings, 0 replies; 2+ messages in thread
From: Glenn Sullivan @ 1998-09-23 15:55 UTC (permalink / raw)
To: pgsql-sql@hub.org
Hi,
I am new to Postgre (and databases), and just figuring how to
use it. I see numerous references to cursors, but I do not
understand what they are for. Could someone point me to someplace
to read, or give me one paragraph to enlighten me.
Thanks,
Glenn
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] Cursors
@ 1998-09-23 20:09 Richard Lynch <lynch@lscorp.com>
0 siblings, 0 replies; 2+ messages in thread
From: lynch@lscorp.com @ 1998-09-23 20:09 UTC (permalink / raw)
To: Glenn Sullivan <glenn.sullivan@nmr.varian.com>; +Cc: pgsql-sql@hub.org
>I am new to Postgre (and databases), and just figuring how to
>use it. I see numerous references to cursors, but I do not
>understand what they are for. Could someone point me to someplace
>to read, or give me one paragraph to enlighten me.
Suppose you have a *HUGE* database. Like Publisher's Clearinghouse you may
already have won a million dollars huge. If you were going to look at it
on the web, you really, REALLY, *REALLY* don't want to do a query like:
"select * from losers order by lastname, firstname"
It's pretty much guaranteed to choke the machine, eh? "Imminent Death of
the Internet, Film at 11."
So, you use a cursor. A cursor allows you to select a specific range
within a large set of records, but also have order by and group by behave
properly.
By creating a cursor and using that cursor in a query, the result set can
be calculated by the backend, but only a tiny fraction of that set will be
transmitted to the the browser at one time.
The backend *MIGHT* even be really smart and not have to do the *WHOLE*
sort, before allowing you to get the first N records, but I dunno about
that for sure.
The details on how to use cursors in PostgreSQL are in the archives, so I
won't repeat them here.
Disclaimer: Main because I dunno how to use them. I've never had a db
that large. :-)
--
--
-- "TANSTAAFL" Rich lynch@lscorp.com
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1998-09-23 20:09 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-09-23 15:55 Cursors Glenn Sullivan <glenn.sullivan@nmr.varian.com>
1998-09-23 20:09 Re: [SQL] Cursors Richard Lynch <lynch@lscorp.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