pg_total_relation_size accuracy guarantee

From: Nikita <jne100(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: pg_total_relation_size accuracy guarantee
Date: 2017-11-23 22:11:06
Message-ID: CAMCZdexsp1Y5y3wZ5HqGvie3aYN54Bfy95Yyz2RrLZYy=CrrUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello, I'am currently trying to implement some simple disc space limitation
mechanism for my database. Database is partition based and insert-only - I
insert new rows to the current partition and drop oldest partition when
disc space limit exceeded.

Algorithm is quite simple and it seems it works but I must ensure two
assumptions to avoid extra VACUUM/ANALYZE calls:

1. pg_total_relation_size return predictable approximately correct table
size (apart from some preallocation) without subsequent
VACUUM/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?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message support-tiger 2017-11-24 00:46:47 Re: update field in jsonb
Previous Message Dmitry Lazurkin 2017-11-23 19:12:40 Re: Implementation of gtrgm_out for gevel