Re: TRUNCATE veeeery slow compared to DELETE in 7.4

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: TRUNCATE veeeery slow compared to DELETE in 7.4
Дата
Msg-id 8000.1071086054@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: TRUNCATE veeeery slow compared to DELETE in 7.4  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-performance
Josh Berkus <josh@agliodbs.com> writes:
> Incidentally, I believe that TRUNCATE has always been slightly slower than
> DROP TABLE.

Well, it would be: it has to delete the original files and then create
new ones.  I imagine the time to create new, empty indexes is the bulk
of the time Hartmut is measuring.  (Remember that an "empty" index has
at least one page in it, the metadata page, for all of our index types,
so there is some actual I/O involved to do this.)

It does not bother me that TRUNCATE takes nonzero time; it's intended
to be used in situations where DELETE would take huge amounts of time
(especially after you factor in the subsequent VACUUM activity).
The fact that DELETE takes near-zero time on a zero-length table is
not very relevant.

            regards, tom lane

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

Предыдущее
От: nbarraza@uolsinectis.com.ar
Дата:
Сообщение: ...
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: