Re: FETCH in subqueries or CTEs - Mailing list pgsql-general

From Tom Lane
Subject Re: FETCH in subqueries or CTEs
Date
Msg-id 20128.1345818675@sss.pgh.pa.us
Whole thread Raw
In response to Re: FETCH in subqueries or CTEs  (Craig Ringer <ringerc@ringerc.id.au>)
Responses Re: FETCH in subqueries or CTEs  (Craig Ringer <ringerc@ringerc.id.au>)
List pgsql-general
Craig Ringer <ringerc@ringerc.id.au> writes:
> I didn't find a reasonable way to simply fetch a cursor into a (possibly
> temporary) table, like:
> INSERT INTO sometable FETCH ALL FROM somecursor;

Why would you bother with a cursor, and not just INSERT ... SELECT
using the original query?

Putting a cursor in between will just make matters more complicated and
slower.  (For one thing, the plan created for a cursor is optimized for
incremental fetching not read-it-all-at-once.)

            regards, tom lane


pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: FETCH in subqueries or CTEs
Next
From: Tom Lane
Date:
Subject: Re: Rules, Windows and ORDER BY