xiao Posted January 10, 2008 Share Posted January 10, 2008 e.g.: I have 2 tables: 'job' & 'employer' Job contains stuff like description, title, type, ... Employer contains name, address, ... I want to show the employer in my job description. I can do 2 things: - Store the name of the employer in the 'job' table - Store the employer's id in the 'job' table and get the employer's name from another query. the 2nd option saves space and is the right way to do this, but doesn't it take more time for the page to load when I do this? Since it's an extra calculation. Quote Link to comment https://forums.phpfreaks.com/topic/85402-db-optimization/ Share on other sites More sharing options...
teng84 Posted January 10, 2008 Share Posted January 10, 2008 maybe yes but it takes more time to load when your DB is crowded. it takes more time to query on one single table having huge data than querying some tables having less data (normalization) Quote Link to comment https://forums.phpfreaks.com/topic/85402-db-optimization/#findComment-436021 Share on other sites More sharing options...
fenway Posted January 11, 2008 Share Posted January 11, 2008 Don't even consider *not* storing the ID. Quote Link to comment https://forums.phpfreaks.com/topic/85402-db-optimization/#findComment-436698 Share on other sites More sharing options...
xiao Posted January 11, 2008 Author Share Posted January 11, 2008 I always store IDs, even if I don't plan to use them at first. Quote Link to comment https://forums.phpfreaks.com/topic/85402-db-optimization/#findComment-436793 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.