问题描述
我正在使用psql访问postgres数据库。在查看表的元数据时,是否可以查看表的索引是否为聚集索引?
I'm using psql to access a postgres database. When viewing the metadata of a table, is there any way to see whether an index of a table is a clustered index?
我听说表的PRIMARY KEY是
I heard that the PRIMARY KEY of a table is automatically associated with a clustered index, is it true?
推荐答案
请注意PostgreSQL使用术语聚集索引来模糊地使用某些东西吗?
Note that PostgreSQL uses the term "clustered index" to use something vaguely similar and yet very different to SQL Server.
如果已将特定索引指定为表的聚集索引,则psql的 \d
命令将指示聚集索引,例如,
If a particular index has been nominated as the clustering index for a table, then psql's \d
command will indicate the clustered index, e.g.,
Indexes:
"timezone_description_pkey" PRIMARY KEY, btree (timezone) CLUSTER
PostgreSQL默认不将索引指定为聚簇索引。即使这样命名,它也不会自动安排表数据与聚簇索引相关:必须使用CLUSTER命令来重新组织表数据。
PostgreSQL does not nominate indices as clustering indices by default. Nor does it automatically arrange table data to correlate with the clustered index even when so nominated: the CLUSTER command has to be used to reorganise the table data.
这篇关于关于Postgres中的聚集索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!