Optimize SQL databases by adding index columns
Posted
by Viktor Sehr
on Stack Overflow
See other posts from Stack Overflow
or by Viktor Sehr
Published on 2010-05-26T11:47:56Z
Indexed on
2010/05/26
11:51 UTC
Read the original article
Hit count: 475
This might be implementation specific so the question regards how SQL databases is generally implemented.
Say I have a database looking like this;
Product with columns [ProductName] [Price] [Misc] [Etc]
Order with columns [OrderID] [ProductName] [Quantity] [Misc] [Etc]
ProductName is primary key of Product, of some string type and unique.
OrderID is primary key and of some integer type, and ProductName being a foreign key.
Say I change the primary key of Product to a new column of integer type ie [ProductID]
Would this reduce the database size and optimize lookups joining these two tables (and likewise operations), or are these optimizations performed automatically by (most/general/main) SQL database implementations?
© Stack Overflow or respective owner