Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

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 January 21st, 2009, 12:07 PM
MagSafe MagSafe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Posts: 84 MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 22 h 52 m 26 sec
Reputation Power: 71
Database organisation

Just thought I'd ask on here for database organisation advice,

What i've got is a table called "tblVillas" which will have villa's inside it, with fields such as name, description, location, bedrooms, bathroom, etc.

Thinking of the future though, we might expand to hotels, caravans, cottages etc and would want to search through all these at once.

I was going to change "tblVillas" to "tblListings", so everything can be stored in there if we ever did expand, and I could put in a relationship ID to say if its a villa, hotel, caravan, etc. Would this be a sensible thing to do?, or would it be better to keep them in seperate tables and create a dynamic table with join's if we ever expanded?

If we did expand it would be when that table would have 1000's of villa's in it, so I'm thinking keeping them seperate to improve speed would be better, but would like the opinions of other people that already manage huge databases.

Thanks

Reply With Quote
  #2  
Old January 21st, 2009, 01:54 PM
ahk2chan ahk2chan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Location: Canada
Posts: 84 ahk2chan User rank is Sergeant (500 - 2000 Reputation Level)ahk2chan User rank is Sergeant (500 - 2000 Reputation Level)ahk2chan User rank is Sergeant (500 - 2000 Reputation Level)ahk2chan User rank is Sergeant (500 - 2000 Reputation Level)ahk2chan User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 15 h 58 m 8 sec
Reputation Power: 10
If all the different types of properties will end up having a majority of the same set of attributes, then you would basically put them all in 1 table and using a "type" column to identify what type of listing each row is.

Then you can have create type-specific table if there are type-specific attributes.

For general searching, if you can put all the information for search result page in the common table, then you will not need to join any table for type-specific data until when your customer is interested in a particular listing. (PK access)

For type-specific search, you will have to join, but if you can index the "type" column in the common table.

In general, common DB engines should be able to handle 1000's rows in a table without any problem and with minimal DB config tuning, IF you develop optimized SQLs
Comments on this post
jzd agrees: Completely agree.
bobby_handzhiev agrees!

Reply With Quote
  #3  
Old January 22nd, 2009, 04:24 AM
MagSafe MagSafe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Posts: 84 MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level)MagSafe User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 22 h 52 m 26 sec
Reputation Power: 71
Thanks for that, really helpful

I've amended my database and PHP to put everything together in the one table.

Reply With Quote
  #4  
Old January 22nd, 2009, 06:00 AM
bobby_handzhiev bobby_handzhiev is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Location: Bulgaria
Posts: 18 bobby_handzhiev User rank is Sergeant (500 - 2000 Reputation Level)bobby_handzhiev User rank is Sergeant (500 - 2000 Reputation Level)bobby_handzhiev User rank is Sergeant (500 - 2000 Reputation Level)bobby_handzhiev User rank is Sergeant (500 - 2000 Reputation Level)bobby_handzhiev User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 52 m
Reputation Power: 0
In addition to what ahk2chan said, it depends on what your site is going to do. If you are going to threat villas, hotels etc. absolutely separately (i.e. separate search, different views etc), you can as well keep them in separate tables to save yourself from the hassle of joins.

But if there is some common data you'd better keep them in one table and put extra data in related tables.

If there will be any kind of search or sort that will be done on all object, then using one "listings" table is absolutely needed.

Reply With Quote
  #5  
Old January 27th, 2009, 10:07 AM
paulh1983 paulh1983 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Dec 2004
Posts: 1,354 paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 10 h 36 m 33 sec
Reputation Power: 18
bobby: you have completely contradicted yourself.

I think a database can do joins more efficiently rather than searching all the diff tables for info esp if there will be huge amount of rows. (correct me if i am wrong)

Reply With Quote
  #6  
Old May 9th, 2009, 04:34 PM
bobby_handzhiev bobby_handzhiev is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Location: Bulgaria
Posts: 18 bobby_handzhiev User rank is Sergeant (500 - 2000 Reputation Level)bobby_handzhiev User rank is Sergeant (500 - 2000 Reputation Level)bobby_handzhiev User rank is Sergeant (500 - 2000 Reputation Level)bobby_handzhiev User rank is Sergeant (500 - 2000 Reputation Level)bobby_handzhiev User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 h 52 m
Reputation Power: 0
Quote:
Originally Posted by paulh1983
bobby: you have completely contradicted yourself.

I think a database can do joins more efficiently rather than searching all the diff tables for info esp if there will be huge amount of rows. (correct me if i am wrong)


Very late response, but anyway: you will be able to do joins only if you have one table for an anchor. (i.e. "listings"). Then the related data can stay in different tables (you'll have a painful query though). If your tables are completely unrelated, good luck getting search-able and sortable data from them at once.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Database organisation


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




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek