ฉันมี decently ใหญ่ 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'
....