Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 08-13-2007, 04:33 AM what would you do?
Experienced Talker

Posts: 34
Name: Dan
Trades: 0
Ok, here's a question for all you database boffins. In work, we have a *very* large database. And a re-write of our system pending. On this re-write, we intend to optimize the database, and shuffle data around. Here's the current scenario.
We have 53 tables in all. Most of which don't matter to this example. Just 2. There's a "logging" table, which has around 22 million rows of vehicle tracking data. Each row has an ID reference to a vehicle table. Then there's a second table, "addresses", which stores it's own unique key, the actual name of the latitude/longitude, and a code reference to the logging table (one for each line). When a query is done, it has to join these 2 tables together, to get the address from the addresses table, and the rest of the details from the logging table.
Me & my collegue both have different views on how this should be properly designed. Here's my view:
Put the addresses "name" at the end of the logging table, thus removing the addresses table completely. This will eliminate the need to join these tables at all. We end up having complex routines in place to handle situations where logging entries do not have addresses for any reason.
His view:
Split the logging table up, and make a new table (that would effectively replace the addresses table), called "locations". In there, would store the latitude & longitude, and the address name in question. Then the logging table has an entry that references a unique code number in the locations table, still having to join them.

I think both edits are valid, but which one would you pick? Or would you do it a different way?
I'm looking forward to hearing your views on this.
Thanks
__________________

Please login or register to view this content. Registration is FREE

1Gb hosting from as little as £1.49/€2.20/$3 /month - No kidding!
danneh3826 is offline
Reply With Quote
View Public Profile Visit danneh3826's homepage!
 
 
Register now for full access!
Old 08-13-2007, 07:39 AM Re: what would you do?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Giving a specific answer or a DB schema without understanding the data and how it correlates would be the wrong thing to do as it may lead you down a totally inappropriate path.

The best way in just about every DB schema is one that reduces the data redundancy in the tables to near zero (or zero if possible).
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-13-2007, 06:48 PM Re: what would you do?
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Joining two tables is often less work and strain on the server than parsing wider tables. But what Hirst said is 110% true.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 08-17-2007, 03:04 PM Re: what would you do?
Super Talker

Posts: 130
Trades: 0
I agree with the two previous posts, also you can always use EXPLAIN in your queries to see what toll is taken on the server in either scenario.
__________________
flann

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
flann is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to what would you do?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14962 seconds with 12 queries