Re: Get the offset of a tuple inside a table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pei He <hepeimail(at)gmail(dot)com>
Cc: Szymon Guz <mabewlun(at)gmail(dot)com>, Kevin(dot)Grittner(at)wicourts(dot)gov, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Get the offset of a tuple inside a table
Date: 2010-09-22 01:32:12
Message-ID: 13464.1285119132@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Pei He <hepeimail(at)gmail(dot)com> writes:
> What I want to do is, for a given key return the tuples that Index scan can
> find, and return the rest tuples by a seq scan. So, I need to know which
> tuples have been returned by maintain a bitmap, and to avoid return the same
> tuple twice.

> If I can know the offset of a tuple in the order of file scan, then I can
> force the seq scan to skip it.

As pointed out, "offset" is an unworkable concept here. That's why the
tidbitmap code doesn't work with offsets; it works with tids. You don't
really need to reinvent this wheel. Go read the bitmapscan code.

(One wonders though what you think you are going to save if you have to
do a seqscan anyway. Where's the advantage over just doing a seqscan?)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2010-09-22 01:40:11 Re: ALTER TYPE extensions
Previous Message Tom Lane 2010-09-22 01:20:06 Multi-branch committing in git, revisited