Subject | Index Design Question |
---|---|
Author | andrew_s_vaz |
Post date | 2002-02-18T23:17:55Z |
Hi all,
I have 2 tables in the db that are really busy. I figured out the
ways that they are most readed and have some doubts on creating the
indexes for them.
First Example:
Table A
The most used querys have a Where clause with
FieldA = 1
FieldB = 2
FieldC = 3
FieldD = 4
FieldE = 5
Order by FieldF
Note that all fields are Integers.
How would the most "optimized" be?
(FieldA, FieldB, FieldC, FieldD, FieldE, FieldF)?
Or would it be better to Make an Index with Field A to E in one index
and FieldF on another one?
Example 2:
Table B
The most used querys have a Where clause with
FieldA = 1
FieldB = 2
FieldC = 3
FieldD = 4 <- this field isn't always present
FieldE = 5 <- this field isn't always present
Order by FieldF
Note that all fields are Integers.
How would an "Optimized" index for this table be? Since FieldD and E
aren't always present (they are Dynamic Queries, it depends on the
user defined conditions before executing the query).
Should it be
(FieldA, FieldB, FieldC) and the other fields on other indexes?
TIA
Andrew
I have 2 tables in the db that are really busy. I figured out the
ways that they are most readed and have some doubts on creating the
indexes for them.
First Example:
Table A
The most used querys have a Where clause with
FieldA = 1
FieldB = 2
FieldC = 3
FieldD = 4
FieldE = 5
Order by FieldF
Note that all fields are Integers.
How would the most "optimized" be?
(FieldA, FieldB, FieldC, FieldD, FieldE, FieldF)?
Or would it be better to Make an Index with Field A to E in one index
and FieldF on another one?
Example 2:
Table B
The most used querys have a Where clause with
FieldA = 1
FieldB = 2
FieldC = 3
FieldD = 4 <- this field isn't always present
FieldE = 5 <- this field isn't always present
Order by FieldF
Note that all fields are Integers.
How would an "Optimized" index for this table be? Since FieldD and E
aren't always present (they are Dynamic Queries, it depends on the
user defined conditions before executing the query).
Should it be
(FieldA, FieldB, FieldC) and the other fields on other indexes?
TIA
Andrew