Peter
Peter

Reputation: 1206

Index on partitioned table: Naming of indexes on partitions

In postgres, when I create an index on a partitioned table e.g. via

CREATE INDEX foo_idx ON measurement (city_id,peaktemp);

Postgres creates an index on each partition of the table for me initially and when I add new partitions to the table. But I do not like the naming schema which seems to be

partition_name + index columns + literal 'idx'

Can I influence that naming schema? I would prefer

name of index on parent table + partition name

Upvotes: 1

Views: 604

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247625

You cannot influence the name PostgreSQL chooses, but it is simple to rename the indexes on the partitions afterwards.

If you attach a table as a new partition, there is another way: create the index with the name of your choice before you attach the partition, then PostgreSQL will automatically use that index as partition of the partitioned index.

Upvotes: 1

Related Questions