sql - Details of impact for indexes, primary keys, unique keys -
i think know enought theory, have little experience optimizing db in real world. know points of view, thoughts or experiences.
let's imagine scenario like:
table key: c1, c2, c3, c4 index: c7, c3, c2
table b key: c1, c2, c3, c4 index: c1, c5
all non-clustered. tables have 40+ fields. feeded daily night , have updates during day.
table a, if more queries benefit key index, index impact negatively? because insert/delete has update 2 indexes instead of 1.
table b, has field @ index, not present in key.
could query using c1, c5
benefit key?: key: c1, c2, c3, c4, c5
so index droped.
what impact order of fields has? key: c1, c2, c3 key: c3, c1, c2
a typical scenario me process_date, client_number, operation. , feeds bunch of data each day (process_date).
if more queries benefit key index, index impact negatively? because insert/delete has update 2 indexes instead of 1.
a non-clustered index has negative impact on insert/update/delete performance. negative impact outweighed increased performance of selects.
could query using c1, c5 benefit key?: key: c1, c2, c3, c4, c5
yes, if few rows share same c1, index effective.
what impact order of fields has? key: c1, c2, c3 key: c3, c1, c2
order important, both filtering , ordering. index on (c1,c2) can used where c1 = 1
, where c1 = 1 , c2 = 1
, not where c2 = 1
. likewise, helps order c1
, not order c2
.
Comments
Post a Comment