Re: [Proposal] Global temporary tables - Mailing list pgsql-hackers

From Konstantin Knizhnik
Subject Re: [Proposal] Global temporary tables
Date
Msg-id 3c68995f-0b2e-1c24-d4f5-d2f11c9dd34f@postgrespro.ru
Whole thread Raw
In response to Re: [Proposal] Global temporary tables  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [Proposal] Global temporary tables
List pgsql-hackers

On 31.01.2020 22:38, Robert Haas wrote:
> Now, your idea is not quite as crazy as that, but it has the same
> basic problem: you can't insert code into a low-level facility that
> uses a high level facility which may in turn use and depend on that
> very same low-level facility to not be in the middle of an operation.
> If you do, it's going to break somehow.
>

Thank you for explanation.
You convinced me that building indexes from _bt_getbuf is not good idea.
What do you think about idea to check and build indexes for GTT prior to 
query execution?

In this case we do not need to patch code of all indexes - it can be 
done just in one place.
We can use build function of access method to initialize index and 
populate it with data.

So right now when building query execution plan, optimizer checks if 
index is valid.
If index belongs to GTT, it an check that first page of the index is 
initialized and if not - call build method for this index.

If building index during building query plan is not desirable, we can 
just construct list of indexes which should be checked and
perform check itself and building indexes somewhere after building plan 
but for execution of the query.

Do you seem some problems with such approach?


-- 
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company




pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: Parallel grouping sets
Next
From: Konstantin Knizhnik
Date:
Subject: Re: [Proposal] Global temporary tables