Eu tenho um decentemente grande postgres tabela com alguns bilhões de linhas.
No entanto, a tabela pode ser particionada por uma coluna (type
)
Devemos preferir:
Um índice com duas colunas
create nonclustered index ix_index1 on table1(type, string_urn_id)
ou condicional, o índice de
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'
....