On 16 Leden 2012, 15:28, Tore Halvorsen wrote:
> On Mon, Jan 16, 2012 at 3:20 PM, Tomas Vondra <tv@fuzzy.cz> wrote:
> [...]
>
>>
>> WHERE ctid >= '(123,0)'::tid AND ctid < '(124,0)'::tid
>>
>>
> Ah, forgot a point here - without doing a sequential scan.
Hmmm, you could create an index on the ctid column, but that'd give you
bitmap index scan and not tid scan (which is probably what you're looking
for).
The only other solution is to check all possible items on the page. There
may be up to 291 items (although it depends on block size and
architecture, see MaxHeapTuplesPerPage in access/htup.h).
Something like this should work
ctid = '(123,0)'::tid OR ctid = '(123,1)'::tid OR ctid = '(123,2)'::tid
OR ... OR ctid = '(123,290)'::tid
But maybe someone will recommend a better solution.
Tomas