Good day. I was reading Postgres official documentation related to Vacuum process and Reindex routine. Some sentences were unclear for me so I want to clarify them.(Postgres documentation for version 12)
First of all. I did understand that autovacuum checks table for dead tuples, stores their locations in special memory called "maintenance_work_mem" and then when this memory is full, vacuum delete corresponding pages in all indexes that have references to those locations. Documentation about reindex says
B-tree index pages that have become completely empty are reclaimed for re-use. However, there is still a possibility of inefficient use of space: if all but a few index keys on a page have been deleted, the page remains allocated
The question is. If "page remains allocated" then does it mean that autovacuum doesn't return physical space from deleted pages inside the index to OS? For example index takes 1 GB of memory. I deleted all but one row from table and ran vacuum. In this case index will still occupy 1 Gb of memory . Am I right?