For temporary tables; truncate vs on commit delete all

Поиск
Список
Период
Сортировка
От Jim Vanns
Тема For temporary tables; truncate vs on commit delete all
Дата
Msg-id CAH7vdhOJLi9eSr_i0KkEG60prha=y=VjY7KvMOa-p3WUwTZUTg@mail.gmail.com
обсуждение исходный текст
Ответы Re: For temporary tables; truncate vs on commit delete all  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-general
Does anyone have any idea which is generally better (by better I mean
most efficient/quickest!) in this simple scenario? I have a temporary
table which I wish to retain for the duration of a long-running
session. However, for each transaction it must be purged. So, is it
better to;

a) Always CREATE TEMPORARY TABLE + ON COMMIT DROP for every transaction or;
b) TRUNCATE TABLE or;
c) ON COMMIT DELETE ROWS

Both b & c avoid re-creating the table each time but at the cost of an
explicit purge of some form.
I would assume that despite its name, the latter, example c, is more
akin to a truncation? Or does it actually perform a deletion?

Cheers

Jim

-- 
Jim Vanns
Principal Production Engineer
Industrial Light & Magic, London



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

Предыдущее
От: Will Roper
Дата:
Сообщение: Re: Logical replication fails when adding multiple replicas
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: For temporary tables; truncate vs on commit delete all