RE: [PATCH] Speedup truncates of relation forks

Поиск
Список
Период
Сортировка
От Tsunakawa, Takayuki
Тема RE: [PATCH] Speedup truncates of relation forks
Дата
Msg-id 0A3221C70F24FB45833433255569204D1FC4CB12@G01JPEXMBYT05
обсуждение исходный текст
Ответ на Re: [PATCH] Speedup truncates of relation forks  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Ответы Re: [PATCH] Speedup truncates of relation forks  (Masahiko Sawada <sawada.mshk@gmail.com>)
Список pgsql-hackers
From: Tomas Vondra [mailto:tomas.vondra@2ndquadrant.com]
> Years ago I've implemented an optimization for many DROP TABLE commands
> in a single transaction - instead of scanning buffers for each relation,
> the code now accumulates a small number of relations into an array, and
> then does a bsearch for each buffer.
> 
> Would something like that be applicable/useful here? That is, if we do
> multiple TRUNCATE commands in a single transaction, can we optimize it
> like this?

Unfortunately not.  VACUUM and autovacuum handles each table in a different transaction.

BTW, what we really want to do is to keep the failover time within 10 seconds.  The customer periodically TRUNCATEs
tensof thousands of tables.  If failover unluckily happens immediately after those TRUNCATEs, the recovery on the
standbycould take much longer.  But your past improvement seems likely to prevent that problem, if the customer
TRUNCATEstables in the same transaction.
 

On the other hand, it's now highly possible that the customer can only TRUNCATE a single table in a transaction, thus
runas many transactions as the TRUNCATEd tables.  So, we also want to speed up each TRUNCATE by touching only the
buffersfor the table, not scanning the whole shared buffers.  Andres proposed one method that uses a radix tree, but we
don'thave an idea how to do it yet.
 

Speeding up each TRUNCATE and its recovery is a different topic.  The patch proposed here is one possible improvement
toshorten the failover time.
 


Regards
Takayuki Tsunakawa







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

Предыдущее
От: Richard Guo
Дата:
Сообщение: Parallel grouping sets
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Resume vacuum and autovacuum from interruption and cancellation