Creating multiple indexes in one table scan.

Поиск
Список
Период
Сортировка
От Gurjeet Singh
Тема Creating multiple indexes in one table scan.
Дата
Msg-id CABwTF4VojjxFzBUWb_V8ytDViMj4CPQ0ESw-nfBJO73FyBkp0Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: Creating multiple indexes in one table scan.  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-hackers
I was going though the minutes of PGCon 2012 DEveloper Meeting [1] and came across this:
    Bruce points out the even simpler case is to build several indexes in parallel over the same scan.

I thought I had posted a patch to that effect long back, but upon searching my emails apparently I forgot about the patch.

Attached is the patch that I developed in Nov. 2010, so expect a lot of bit rot. I had tried to make it elegant, but I have to admit its a hack. This patch does not imply that it is using any kind of parallelism, the context in which that above statement was made. It just helps to avoid scanning the same relation multiple times. I performed some tests on it and AFAICR, this did not produce a net win. But those tests may have been performed in a virtual machine and not on a bare metal, I forget.

AFAICR, this is how it works:

.) It introduces a new type of SQL statement:
    CREATE INDEX ....., CREATE INDEX ..., CREATE INDEX.

    That is, it makes it legal to join multiple CREATE INDEX statements, separated by comma.

.) During the execution phase (IndexBuildHeapScan()), it gathers all the statements in a stack-like data structure before processing any tuples from the heap.

.) When done gathering all the CREATE INDEX statements, it proceeds to process the heap.

.) For each heap tuple it calls each index's build method as usual.

Best regards,

PS: Please expect intermittent replies over the next few days.

[1] http://wiki.postgresql.org/wiki/PgCon_2012_Developer_Meeting
--
Gurjeet Singh
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

Вложения

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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: pg_stat_statements temporary file
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: pg_receivexlog stops upon server restart