Hi there
I'm in the planning stages of creating a database, and I have two options
here. Which makes more sense, and/or provides better performance for
queries - a single table with hundreds of thousands of rows, or many
tables with less rows?
GOAL:
Recording information about buildings, storey by storey. Basically I
will be recording six bits of information about each storey in each
building.
SETUP:
There will be one table for Buildings for sure. The big question is about
how I should record those six details per storey.
OPTIONS:
A) One table that records building ID, storey number, and the six
measurements per row.
B) Six tables that record building ID, storey number, and the appropriate
measurement.
Eventually, there could be a few thousand buildings in the database, and
each building may have anywhere from 5 to 50 storeys. Not to mention that
"old information" is to be kept and archived as new information about
storeys is added.
This means with option A, I can expect to have a table of a few hundred
thousand rows.... (obviously i would index the BuildingID and Storey
Number). Sounds like a lot(!), but it means that I could retreive/select
information I need with one single query and no table joins.
If I go with option B, I can expect to have to do six table joins/queries
when retreiving information about one storey in one building, however
there will be less records to sift through.
Which is the better option to take, and why? By 'better', I am referring
to database performance/speed, updates and other future maintenance on
the database. All opinions welcome.
Thanks,
GM
,
I'm in the planning stages of creating a database, and I have two options
here. Which makes more sense, and/or provides better performance for
queries - a single table with hundreds of thousands of rows, or many
tables with less rows?
GOAL:
Recording information about buildings, storey by storey. Basically I
will be recording six bits of information about each storey in each
building.
SETUP:
There will be one table for Buildings for sure. The big question is about
how I should record those six details per storey.
OPTIONS:
A) One table that records building ID, storey number, and the six
measurements per row.
B) Six tables that record building ID, storey number, and the appropriate
measurement.
Eventually, there could be a few thousand buildings in the database, and
each building may have anywhere from 5 to 50 storeys. Not to mention that
"old information" is to be kept and archived as new information about
storeys is added.
This means with option A, I can expect to have a table of a few hundred
thousand rows.... (obviously i would index the BuildingID and Storey
Number). Sounds like a lot(!), but it means that I could retreive/select
information I need with one single query and no table joins.
If I go with option B, I can expect to have to do six table joins/queries
when retreiving information about one storey in one building, however
there will be less records to sift through.
Which is the better option to take, and why? By 'better', I am referring
to database performance/speed, updates and other future maintenance on
the database. All opinions welcome.
Thanks,
GM
,
Comment