Re: pg_total_relation_size accuracy guarantee

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: pg_total_relation_size accuracy guarantee
Дата
Msg-id 1511507701.2469.5.camel@cybertec.at
обсуждение исходный текст
Ответ на pg_total_relation_size accuracy guarantee  (Nikita <jne100@gmail.com>)
Ответы Re: pg_total_relation_size accuracy guarantee  (Nikita <jne100@gmail.com>)
Список pgsql-general
Nikita wrote:
> 1. pg_total_relation_size return predictable approximately correct table size (apart from some preallocation) without
subsequentVACUUM/ANALYZE/anything call as long as I don't DELETE/UPDATE rows;
 
>  
> 2. DROP/TRUNCATE table reclaim disc space without subsequent VACUUM;
>  
> These assumptions are correct? Is it fixed in doc if so?

Sort of, if you consider the source as documentation.

Ad pg_total_relation_size:

See the function definition in backend/utils/adt/dbsize.c and
the functions that it calls, especially "calculate_relation_size":

PostgreSQL uses the stat(2) system call to determine the actual
size of the files on disk.

Ad TRUNCATE (from backend/commands/tablecmds.c):
 /*  * Need the full transaction-safe pushups.  *  * Create a new empty storage file for the relation, and assign it  *
asthe relfilenode value. The old storage file is scheduled for  * deletion at commit.  */
 

Yours,
Laurenz Albe


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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: On Judging the Value of Tests
Следующее
От: Nikita
Дата:
Сообщение: Re: pg_total_relation_size accuracy guarantee