I have 117 columns in a table, with a total column length of 1290. All of my queries against this table (4) work extremely fast because there are no joins.
However, 69 of the fields are tinyint fields that are only used (in the where clause) by one of the queries about 25% of the time.
Question: Should I move the 69 fields to another table and do a query with a join (just for that query)... or since it is only 69 tinyint, does it really make a difference? Having it in one table is easier.
I'm just afraid of the total length of the columns (1290) and total fields (117) in this table and how it might get slow later if everything is in one table... and I could move the 69 to another table.
Design decisions like this drive me crazy, because I consider myself a 'programmer' not a designer.
Requires Free Membership to View
You'll be fine as long as you don't have more than a few million rows.
If any of your queries search on a column, i.e. use a column in a WHERE clause, then you should consider an index on that column.
For More Information
- Dozens more answers to tough SQL questions from Rudy Limeback.
- The Best SQL Web Links: tips, tutorials, scripts, and more.
- Have an SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, SQL Server, DB2, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
This was first published in September 2003
Join the conversationComment
Share
Comments
Results
Contribute to the conversation