Something else I should mention is in regard to good design decisions. This information may actually be more helpful to you.

With any given database engine, there are good times to use indexes and bad times, as far as speed and space optimization goes.

Generally speaking, you should only use indexes on table columns that have a lot of distinct values, and each one only appears a few times. You should not use indexes on columns that have few distinct values and each appears many times; in the latter case, a full table scan would be faster.

I think a suggested borderline is at 5%. If each distinct column value always/usually occurs in less than 5% of the records, then index the column; if each distinct value usually occurs in more than 5% of the records, then do not index the column.

The actual best borderline may be different, but it's in that ballpark.

And don't forget, this rule is per column. You can do it in some tables and not others. Also, you should never index a column you won't search on.

Note that if you have a unique key constraint on a column, then it will be implicitely indexed. My comments only apply to explicit indexes.

-- Darren Duncan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to