Re: relpages of btree indexes are not truncating even after deleting all the tuples from table and doing vacuum

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Mahendra Singh <mahi6run(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: relpages of btree indexes are not truncating even after deleting all the tuples from table and doing vacuum
Date: 2019-12-23 21:11:30
Message-ID: CAH2-WzkwsnhE0KCc_otExpvQZBH9tvm1zifA4KvRLzpo7kKx+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 23, 2019 at 11:05 AM Mahendra Singh <mahi6run(at)gmail(dot)com> wrote:
> From above example, we can see that after deleting all the tuples from table and firing vacuum command, size of table is reduced but size of index relation is same as before vacuum.

VACUUM is only able to make existing empty pages in indexes recyclable
by future page splits within the same index. It is not possible for it
to reclaim space for the filesystem. Workload characteristics tend to
determine whether or not this limitation is truly important.

You can observe which pages are "free" in this sense (i.e. whether
they've been placed by the FSM for recycling) by using
contrib/pg_freespacemap.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-12-23 21:33:55 Re: unsupportable composite type partition keys
Previous Message Ashwin Agrawal 2019-12-23 20:28:36 Re: Should we rename amapi.h and amapi.c?