Re: A thought on Index Organized Tables - Mailing list pgsql-hackers

From Gokulakannan Somasundaram
Subject Re: A thought on Index Organized Tables
Date
Msg-id 9362e74e1002241204x60c846cah90d9957c0e751edf@mail.gmail.com
Whole thread Raw
In response to A thought on Index Organized Tables  (Gokulakannan Somasundaram <gokul007@gmail.com>)
Responses Re: A thought on Index Organized Tables  (Greg Stark <gsstark@mit.edu>)
Re: A thought on Index Organized Tables  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List pgsql-hackers

That doesn't work because when you split an index page any sequential
scan in progress will either see the same tuples twice or will miss
some tuples depending on where the new page is allocated. Vacuum has a
clever trick for solving this but it doesn't work for arbitrarily many
concurrent scans.

Consider how the range scans are working today, while the page split happens.

The Seq scan should follow the right sibling to do the seq scan.

Gokul.


Actually thinking about what you suggested for a while, i think it should be possible, because the Oracle Fast Full Index scan essentially scans the index like that. I will try to think a way of doing that with Lehman and Yao...

Gokul.

OK I think, i can think of a solution to achieve fast full index scan like oracle.
a) Issue ids to every block that gets created inside the index. we are already doing that
b) Now before the fast full index scan starts, note down the max id that got issued.
c) Now do a scan similar to Full Table Scan till that max id. Now, while we are scanning the blocks, note down the right siblings in a list, if the right sibling block id is greater than the max id that got issued. These are the ones, which have got split after the scan started
d) Now after we reach that max block, try to range scan on missing links till we hit the end / get a right sibling less than the max block id noted.

Once we do this for all the missing links, we have scanned through the entire chain. So this will definitely be faster than range scan.

Thanks to you, i have thought about an important issue and also a solution for it.

Thanks,
Gokul.

pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: pg_stop_backup does not complete
Next
From: Richard Huxton
Date:
Subject: Re: FW: Unable to install PostgreSQL on Windows Server 2003 SP2