This is a very broad question but here goes:
Is it more efficient and better to create tables with more columns and fewer records, or more records and fewer columns?
IE
NAME BusFlag OrgFlag ResFlag
bus1 1 0 0
church1 0 1 0
mr. doe 0 0 1
or
NAME TypeFlag
bus1 B
church1 O
mr. doe R
I know this is a very simplistic example and obvious that the second format is better memory and table speed wise but when you start talking about many columns and thousands upon thousands of records is it better to trim down columns and duplicate records?
name compProduct compAccessory compWarranty
Jon pro2000 printer 2yr
bob home100 camera 1yr
bob PDA
now i know this isn't the greatest but instead have 2 columns:
name product
jon pro2000
jon printer
jon 2yr
bob home100
bob camera...
now databases will be more complex and the 2nd example allows you to have an infinite amount of products ordered for one person but duplicates the name. so my question between the 2 is a table with 4 columns and 3 records faster than a table with 2 columns and 5 records when quering. (of course think in the terms of millions of records or 100k+)
does the amount of columns affect query speeds more than the amount of records in its simplest form? (don't consider indexes and other database features...just columns and rows)
Is it more efficient and better to create tables with more columns and fewer records, or more records and fewer columns?
IE
NAME BusFlag OrgFlag ResFlag
bus1 1 0 0
church1 0 1 0
mr. doe 0 0 1
or
NAME TypeFlag
bus1 B
church1 O
mr. doe R
I know this is a very simplistic example and obvious that the second format is better memory and table speed wise but when you start talking about many columns and thousands upon thousands of records is it better to trim down columns and duplicate records?
name compProduct compAccessory compWarranty
Jon pro2000 printer 2yr
bob home100 camera 1yr
bob PDA
now i know this isn't the greatest but instead have 2 columns:
name product
jon pro2000
jon printer
jon 2yr
bob home100
bob camera...
now databases will be more complex and the 2nd example allows you to have an infinite amount of products ordered for one person but duplicates the name. so my question between the 2 is a table with 4 columns and 3 records faster than a table with 2 columns and 5 records when quering. (of course think in the terms of millions of records or 100k+)
does the amount of columns affect query speeds more than the amount of records in its simplest form? (don't consider indexes and other database features...just columns and rows)