Use TableAm API in pg_table_size

From: Georgios <gkokolatos(at)protonmail(dot)com>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Use TableAm API in pg_table_size
Date: 2020-06-16 14:51:31
Message-ID: qzfAa10e5AbhOq0M7O4g-uXfn0E-sKyL1W6Lj6-4Eifz0bujH6OGYqBDvmo9wx3T1Twau-3z3PL383IL4NQPQ9oPj6IJYJgfboeuTB0FJM0=@protonmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed that there are several file layout assumptions in dbsize.c which might not hold true for non heap relations attached with the TableAm API. It seems logical that in order to retrieve the disk size of a relation, the existing size method to be used instead.

A small patch is included to demonstrate how such an implementation can look like. Also, the existing method for heap, table_block_relation_size, should be able to address the valid cases where a fork number does not exist.

If this is considered valid, then the same can be applied for indexes too. The more generic calculate_relation_size can be adapted to call into the TableAm for those kinds of relations that makes sense. If agreed, a more complete patch can be provided.

Cheers,
//Georgios

Attachment Content-Type Size
0001-Use-tableam-for-pg_table_size.patch application/octet-stream 3.8 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc Cousin 2020-06-16 15:11:55 slow get_actual_variable_range with long running transactions
Previous Message Tom Lane 2020-06-16 14:37:17 Re: snowball ASCII stemmer configuration