Re: Effects of dropping a large table

Поиск
Список
Период
Сортировка
От Gus Spier
Тема Re: Effects of dropping a large table
Дата
Msg-id CAG8xnidWNPmc4e1W13dzm9ByR3HDEekn8Jv39vhMNSBmx8YJmw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Effects of dropping a large table  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
Ответы Re: Effects of dropping a large table  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
Список pgsql-general
Ah! Truncating a table does not entail all of WAL processes. From the documentation, "TRUNCATE quickly removes all rows from a set of tables. It has the same effect as an unqualified DELETE on each table, but since it does not actually scan the tables it is faster. Furthermore, it reclaims disk space immediately, rather than requiring a subsequent VACUUM operation. This is most useful on large tables." https://www.postgresql.org/docs/14/sql-truncate.html

Regards,
Gus

On Sun, Jul 23, 2023 at 5:51 AM Peter J. Holzer <hjp-pgsql@hjp.at> wrote:
On 2023-07-22 16:37:39 -0400, Gus Spier wrote:
> Isn’t this a perfect opportunity to use the TRUNCATE command to
> quickly remove the data? And follow up by deleting the now empty
> tables?

What's the advantage of first truncating and then deleting a table over
just deleting it?

        hp

--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

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

Предыдущее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: Effects of dropping a large table
Следующее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: Effects of dropping a large table