Re: explicit cursor vs. for loop in pl/pgsql - Mailing list pgsql-general

From David Parker
Subject Re: explicit cursor vs. for loop in pl/pgsql
Date
Msg-id 07FDEE0ED7455A48AC42AC2070EDFF7C746252@corpsrv2.tazznetworks.com
Whole thread Raw
In response to explicit cursor vs. for loop in pl/pgsql  ("David Parker" <dparker@tazznetworks.com>)
List pgsql-general
Thanks for the info. I've got an index, so I guess it's as good as it
gets!

The data is actually copied over from the slony transaction log table,
and there's no way to know how many statements (=rows) there might be
for any given transaction, so assigning an arbitrary limit seems too
risky, and I don't want to take the hit of a select count.

Thanks again.

- DAP

>> The nature of the data is that chunksize doesn't necessarily
>match up
>> one-for-one with rows, so I can't use it as a LIMIT value.
>
>Can you set an upper bound on how many rows you need?  If you
>can put a LIMIT into the select, it'll encourage the planner
>to use an indexscan, even if you break out of the loop before
>the limit is reached.
>
>            regards, tom lane
>

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: explicit cursor vs. for loop in pl/pgsql
Next
From: Jerry Sievers
Date:
Subject: CSV delim quoting differences PgCOPY, Excel etc...