Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 10th, 2003, 08:15 PM
hopper hopper is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 11 hopper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
database design basics - big table searches

I would like some advice on this particular scenario:

Suppose my database is concerned with companies and their people, spread across the US, divided between states and smaller areas. Say some 40,000 companies over perhaps 1000 areas.

With searches on:
1) peoples' names - from the entire country, listing their company,
2) company - from the entire country - together with their people,
3) company by area - a list of all companies in a selected area - together with their people.

(The company list won't change much)

Now I imagine the easiest way to do that would be to have one table for people (which could grow BIG over time) with an ID linked to a separate company table (with 40,000 entries). My questions are:

1) Is one table with 40,000 rows really searchable in mySQL (i.e. quickly)?

2) And if people search by state and area, then that would require a search on two string fields from those 40,000 rows. Would that be reasonable? Or should there be other tables for states and areas? I have no idea whether joins or whole table searches would be quicker in bigger tables. There seems to be conflicting views (or maybe I don't understand it )

I'd like to throw this in the ring and see what others' opinions are... Any advice would be appreciated.
Many thanks

Reply With Quote
  #2  
Old March 10th, 2003, 09:14 PM
roninblade's Avatar
roninblade roninblade is offline
// no comment
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Dec 2001
Posts: 1,639 roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 45 m
Reputation Power: 33
Re: database design basics - big table searches

Quote:
Originally posted by hopper
1) Is one table with 40,000 rows really searchable in mySQL (i.e. quickly)?
2) And if people search by state and area, then that would require a search on two string fields from those 40,000 rows. Would that be reasonable?
yes, it is very much searchable. try searching the php forum here which has 114,718 number of posts.
... and searching one table is definitely faster than searching two.

Reply With Quote
  #3  
Old March 10th, 2003, 09:54 PM
Ctb's Avatar
Ctb Ctb is offline
An Ominous Coward
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jan 2002
Posts: 4,425 Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 10 h
Reputation Power: 0
Dude... ronin... doesn't this post look a little familiar?

Reply With Quote
  #4  
Old March 10th, 2003, 10:06 PM
roninblade's Avatar
roninblade roninblade is offline
// no comment
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Dec 2001
Posts: 1,639 roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 45 m
Reputation Power: 33
duuuuh... i don't have any idea what you're talking about, man.


Reply With Quote
  #5  
Old March 10th, 2003, 10:59 PM
hopper hopper is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 11 hopper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
roninblade,

Thanks for your reply. You say searching 1 table is quicker, so that means, with the company table, rather than having separate tables for state and smaller areas within, with just integer IDs held in two columns in the company table, it's better to hold the actual state and area name strings in each row of the company table? Seems to fly against what I've learnt...Or not?

Ctb,

Sorry - above my head...

Reply With Quote
  #6  
Old March 10th, 2003, 11:11 PM
Ctb's Avatar
Ctb Ctb is offline
An Ominous Coward
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jan 2002
Posts: 4,425 Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 10 h
Reputation Power: 0
//LOL

Nothing... jpenn asked a very similar question not too long ago, but it occurred to me after I posted that, after awhile, he finally did get a response. I thought maybe he was playing a joke or something, but I guess not. My bad! (I know someone here hates that saying...)

Don't mind me... I've wrapped up my project for the night and I'm a bit bored

Reply With Quote
  #7  
Old March 10th, 2003, 11:23 PM
roninblade's Avatar
roninblade roninblade is offline
// no comment
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Dec 2001
Posts: 1,639 roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 45 m
Reputation Power: 33
Quote:
...with just integer IDs held in two columns in the company table...
that's exactly what you should do. i just said it's faster to search in one table rather than in two.

Reply With Quote
  #8  
Old March 10th, 2003, 11:34 PM
hopper hopper is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 11 hopper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Umm...cryptic...the proper way is not the fastest way...

Ok. Any idea where I can find jpenn's original question. Are you sure he started the thread? I can't find it on a search in the database section.

Thanks for your help guys

Reply With Quote
  #9  
Old March 10th, 2003, 11:49 PM
roninblade's Avatar
roninblade roninblade is offline
// no comment
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Dec 2001
Posts: 1,639 roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 45 m
Reputation Power: 33
im not trying to being cryptic here. you should normalize your database as much as possible. well even if you search a single table containing 40000 rows related to a number of other tables, mysql can easily handle the load.

Reply With Quote
  #10  
Old March 11th, 2003, 05:40 AM
hopper hopper is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 11 hopper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK roninblade, thanks a lot for the info. As a beginner to this db game it's difficult to know exactly how much constitutes 'a lot' to a database. I mean, it's difficult to even visualize 40,000 of something...

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > database design basics - big table searches


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway