我有一个相当大的 postgres 表,有几十亿行。
但是,该表可以按一列 ( type)分区
我们应该更喜欢:
具有两列的索引
create nonclustered index ix_index1 on table1(type, string_urn_id)
或条件索引
create nonclustered index ix_index1_alternative on table1(string_urn_id) WHERE type = 'type1'
create nonclustered index ix_index1_alternative2 on table1(string_urn_id) WHERE type = 'type2'
create nonclustered index ix_index1_alternative3 on table1(string_urn_id) WHERE type = 'type3'
....