[HACKERS] Question about memory contexts in ReindexMultipleTables()

Поиск
Список
Период
Сортировка
От Andreas Karlsson
Тема [HACKERS] Question about memory contexts in ReindexMultipleTables()
Дата
Msg-id 376b294e-63d0-0926-9016-53f8d05912a2@proxel.se
обсуждение исходный текст
Список pgsql-hackers
Hi,

When working on REINDEX CONCURRENTLY I noticed that the new memory 
context created in the ReindexMultipleTables() seems pointless.

The purpose claimed in the code for introducing the 
ReindexMultipleTables context is to make sure the list we build with 
relation IDs survive the commit, since a commit destroys the 
TopTransactionContext and ReindexMultipleTables() first runs one 
transaction to list which tables should be reindexed and then reindexes 
each index in a separate transaction.

But in the first transactions where the lsit is built we actually never 
use TopTransactionContext, isntead PortalHeapMemory is used which is a 
memory context which does not go away until the REINDEX command has 
completed. So everything should work in the same way even if we just 
remove the ReindexMultipleTables memory context.

Am I missing something? Should the ReindexMultipleTables memory context 
be removed, or should we switch to TopTransactionContext at the begining 
of ReindexMultipleTables() so temporary resources used in the initial 
transaction can be freed?

Andreas



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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: [HACKERS] Provide list of subscriptions and publications inpsql's completion
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: [HACKERS] Help text for pg_basebackup -R