Guillaume Labelle
Guillaume Labelle

Reputation: 11

Postgres table partitioned shows Index Size of 0

I have a table that is partitioned by range. It also has 10 indexes in it. When I try to get the size of the indexes, the shows a size of 0. The table has 44 million rows in it.

Is that normal behavior?

Upvotes: 1

Views: 1094

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246568

Yes, that is normal.

An index on a partitioned table is a partitioned index. The partitions of the index (which are defined on the table partitions) contain the actual data. Like the partitioned table itself, the partitioned index itself is empty.

To get the actual size, add the size of all index partitions. You can do that with

SELECT sum(pg_relation_size(inhrelid))
FROM pg_inherits
WHERE inhparent = 'indexname'::regclass;

Upvotes: 1

Related Questions