[mythtv] Database normalization things

Chris Petersen lists at forevermore.net
Wed Jul 9 14:09:05 EDT 2003


> 2. Change cases of primary keys convering multiple columns to unique
> keys.  Again, this would help future joins.

btw, there's no real difference (in mysql, anyway) between primary keys
and unique indexes - it's just a matter of semantics so people looking
at the tables know that the fields were intended for use as primary keys
and not just some other random index.

> 3. Add keys to fields that are frequently looked at.

from what I've seen, most of the mythtv tables are indexed as good as
they can be.  Adding an index doesn't do any good unless a query
actually uses that field as its primary search field.  Mysql optimizes
select queries pretty well, so if you're trying to find something that
has a>5 and b="some string", and each field is indexed separately, it's
going to choose the index that offers the best/fastest narrowing-down of
fields, and then manually search the remaining records by the leftover
comparisons.  It can't take two separate indexes and use both of them in
one query.

-Chris



More information about the mythtv-dev mailing list