U mnie jest przyzwoicie duża tabela postgres z kilku miliardów wierszy.
Jednak tabela może być podzielona na jedną kolumnę (type
)
Czy powinniśmy zdecydować się na:
Indeks z dwoma kolumnami
create nonclustered index ix_index1 on table1(type, string_urn_id)
lub warunkowy indeks
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'
....