Re: TRUNCATE veeeery slow compared to DELETE in 7.4

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: TRUNCATE veeeery slow compared to DELETE in 7.4
Дата
Msg-id 13898.1071512507@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: TRUNCATE veeeery slow compared to DELETE in 7.4  (Hartmut Raschick <hartmut.raschick@ke-elektronik.de>)
Список pgsql-performance
Hartmut Raschick <hartmut.raschick@ke-elektronik.de> writes:
> [ TRUNCATE is much slower in 7.4 than in 7.3 ]

After looking into this, I think this is because when Rod Taylor
reimplemented TRUNCATE to make it transaction-safe, he essentially
turned it into a variant of CLUSTER.  It is slow because it is creating
and deleting dummy tables and indexes.  I think this is not really
necessary and it could be done better while still being
transaction-safe.  All we really need is to create a new empty table
file, update the table's pg_class row with the new relfilenode, mark
the old file for deletion, and then run REINDEX TABLE (which will
perform similar shenanigans with the indexes).

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Index problem or function problem?
Следующее
От: Claudia D'amato
Дата:
Сообщение: Postgres respond after toomany times to a query view