I have a table that stores a person’s information with close to 10 million rows.
Currently State is a char(2) field on the person table. This leads to tons of duplication of data as you would expect. If I normalize State data into it’s own table and create an FK to it in the person table would this result in faster query times?
Before:
SELECT Name, City, State FROM Person WHERE State = 'WI'
After:
SELECT p.Name, p.City, s.Name as State
FROM Person p
INNER JOIN State s ON p.State == s.Id
WHERE s.Name = 'WI'
It seems to me that this would accomplish an increase in performance but I am far from an expert when it comes to optimizing queries.
Normalization can result in decreased performance, but rarely if ever will it increase your performance in a case like this, because now the server has to look at two places on disk instead of just one.
Normalization has two purposes:
Your query will not benefit from either of these advantages as