sql - Individual indexes vs multiple field indexes -
currently have table use track inivitations. have email field indexed have 3 optional keys user can specify when adding new record emails. don't allow duplicates have query if email plus optional keys exists. keys added select statement if specified. normal case email specified , using index works quickly. when keys added performance drops.
would adding 3 indexes affect performance other operations? keys used infrequently wouldn't want impact performance case.
- email, key1
- email, key1, key2
- email, key1, key2, key3
the other idea add 1 key.
- email, key1, key2, key3
then use 3 keys in lookup (eg. key1 = mykey , key2 null , key3 null)
see also
personally recommend approach.
try method single index covers everything, if recall correctly still perform if query on first of included columns. once have index in place, run index advisor.
then try other route , repeat.
it depends on data.
i typically have been able 1 covering index, starting used key first.
Comments
Post a Comment