Re: explicit cursor vs. for loop in pl/pgsql

From: "David Parker" <dparker(at)tazznetworks(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "postgres general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: explicit cursor vs. for loop in pl/pgsql
Date: 2005-05-17 19:51:42
Message-ID: 07FDEE0ED7455A48AC42AC2070EDFF7C746252@corpsrv2.tazznetworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
>

Browse pgsql-general by date

  From Date Subject
Next Message Justin Tocci 2005-05-17 19:55:46 TABLEs to VIEWs with Perl
Previous Message Tom Lane 2005-05-17 19:38:43 Re: explicit cursor vs. for loop in pl/pgsql