Re: TRUNCATE TABLE

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: TRUNCATE TABLE
Дата
Msg-id 87ps2ypox3.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на TRUNCATE TABLE  (Adriaan van Os <postgres@microbizz.nl>)
Ответы Re: TRUNCATE TABLE  (Adriaan van Os <postgres@microbizz.nl>)
Список pgsql-performance
"Adriaan van Os" <postgres@microbizz.nl> writes:

> Recently, I have been doing extensive profiling of a version 8.1.4 Postgres DB
> with about 175 tables and 5 GB of data (the server running on Fedora Linux and
> the clients on Windows XP). Surprisingly, one of the bottlenecks is TRUNCATE
> TABLE and that command is really slow as compared to other operations. For
> example, we have operations like:

What filesystem is this? Some filesystems are notoriously slow at deleting
large files. The mythtv folk who face this problem regularly recommend either
JFS or XFS for this purpose.

Postgres generally doesn't really need to be able to delete large files
quickly. The only times files are deleted which come to mind are when you DROP
or TRUNCATE or possibly when you VACUUM a table.

> I noticed, by the way, that removing records in general is painfully slow, but
> I didn't do a detailed analysis of that issue yet.

That's strange. Deleting should be the *quickest* operation in Postgres. Do
you perchance have foreign key references referencing this table? Do you have
any triggers?

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: TRUNCATE TABLE
Следующее
От: Greg Smith
Дата:
Сообщение: Re: WALL on controller without battery?