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 > ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings