Re: Get the offset of a tuple inside a table

Поиск
Список
Период
Сортировка
От Pei He
Тема Re: Get the offset of a tuple inside a table
Дата
Msg-id AANLkTimZf-mvT1ZPqYmosnbSwZRe_5EsC9tC0Lh4wGvJ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Get the offset of a tuple inside a table  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Get the offset of a tuple inside a table  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Hi Tom,<br />The bitmapset works for me.<br /><br />I want to implement the operator for the following query:<br /><br
/>Select* from a left join b on <a href="http://a.id">a.id</a> = <a href="http://b.id">b.id</a> order by <a
href="http://b.id">b.id</a>;<br/><br />In a left outer join, I want the tuples that have matches in the inner table
appearfirst. So, the order by clause is need.<br /><br />If there is a index on <a href="http://a.id">a.id</a>, I can
usethe tuples in b to probe the index.<br /><br />After return all the tuples retrieved through index, it needs to
returnthe rest tuples in a, because it is a left outer join in the query.<br /><br />What I need to do is remember what
havebeen returned by the index, and avoid to return it twice.<br /><br />The bitmapscan needs to remember what have to
beenretrieved later, so it used the tidbitmap. But, for me, I need the bitmapset.<br /> <br />Thanks, your reply helps
meto find the bitmapset.<br /><br />Regards<br />--<br />Pei<br /><br /><br /><div class="gmail_quote">On Tue, Sep 21,
2010at 9:32 PM, Tom Lane <span dir="ltr"><<a href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>></span>
wrote:<br/><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left:1ex;"><div class="im">Pei He <<a href="mailto:hepeimail@gmail.com">hepeimail@gmail.com</a>>
writes:<br/> > What I want to do is, for a given key return the tuples that Index scan can<br /> > find, and
returnthe rest tuples by a seq scan. So, I need to know which<br /> > tuples have been returned by maintain a
bitmap,and to avoid return the same<br /> > tuple twice.<br /><br /> > If I can know the offset of a tuple in the
orderof file scan, then I can<br /> > force the seq scan to skip it.<br /><br /></div>As pointed out, "offset" is an
unworkableconcept here.  That's why the<br /> tidbitmap code doesn't work with offsets; it works with tids.  You
don't<br/> really need to reinvent this wheel.  Go read the bitmapscan code.<br /><br /> (One wonders though what you
thinkyou are going to save if you have to<br /> do a seqscan anyway.  Where's the advantage over just doing a
seqscan?)<br/><br />                        regards, tom lane<br /></blockquote></div><br /> 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: Shutting down server from a backend process, e.g. walrceiver
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Multi-branch committing in git, revisited