From: Tom Lane <tgl@sss.pgh.pa.us>
To: my ho <mthoatbanjo@yahoo.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: execute cursor fetch
Date: Tue, 12 Oct 2004 10:07:56 -0400
Message-ID: <1856.1097590076@sss.pgh.pa.us> (raw)
In-Reply-To: <20041012114343.69531.qmail@web54110.mail.yahoo.com>
References: <20041012114343.69531.qmail@web54110.mail.yahoo.com>
my ho <mthoatbanjo@yahoo.com> writes:
> If anyone can help pls, I have a question abt the
> execution of cursor create/fetch/move , in particular
> about disk cost. When a cursor is created, is the
> whole table (with the required columns) got put into
> memory?
No. The plan is set up and then incrementally executed each time you
say FETCH.
> how does postgre speed up the query in
> compare to normal selection?
The only difference from a SELECT is that the planner will prefer
"fast-start" plans, on the theory that you may not be intending
to retrieve the whole result. For instance it might prefer an
indexscan to a seqscan + sort, when it otherwise wouldn't.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, mthoatbanjo@yahoo.com
Subject: Re: execute cursor fetch
In-Reply-To: <1856.1097590076@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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