rxbanditboy1112 Posted June 21, 2007 Share Posted June 21, 2007 By fast I mean in milliseconds which will take less to process. Let's say I am making a mailing list and many many user can create their own mailing lists. Now is it faster to put all email addresses in 1 huge table and categorize them by who a user_id number of which they belong to. Then when some wants to send an email the algorithm will loop through all the email addresses with user_id numbers. Or would it be more efficient to give each member their own table of email address. Of course the table will need to be looked up, however, there will be no need sort through thousands maybe millions of email address belonging to other users. I suppose the 2nd method would be more efficient? Is there a faster method? If you have the name of a table (perhaps in this case it'd be the user_id number followed by mailing_list (example: 1230202mailing_list) does this provide instant access, or in the background is there a search performed to find the table with the given name. Link to comment https://forums.phpfreaks.com/topic/56615-solved-which-of-these-methods-are-faster-are-their-better-methods/ Share on other sites More sharing options...
trq Posted June 21, 2007 Share Posted June 21, 2007 You need to look at database normalization Your second option isn't really a logical option IMO. Link to comment https://forums.phpfreaks.com/topic/56615-solved-which-of-these-methods-are-faster-are-their-better-methods/#findComment-279623 Share on other sites More sharing options...
rxbanditboy1112 Posted June 21, 2007 Author Share Posted June 21, 2007 Oh that is a helpful link. Let's take another example where normalization isn't possible. Myspace has thousands of comment posts constantly. How would a site like that arrange things like comments so that they are quick to retrieve. Wouldn't the search time be outrageous? Link to comment https://forums.phpfreaks.com/topic/56615-solved-which-of-these-methods-are-faster-are-their-better-methods/#findComment-279644 Share on other sites More sharing options...
trq Posted June 21, 2007 Share Posted June 21, 2007 Wouldn't the search time be outrageous? No. It would be outragous to have a new table created for each user. Link to comment https://forums.phpfreaks.com/topic/56615-solved-which-of-these-methods-are-faster-are-their-better-methods/#findComment-279646 Share on other sites More sharing options...
rxbanditboy1112 Posted June 21, 2007 Author Share Posted June 21, 2007 hahaha alright. I was just checking. So search time in a database is not determined by the number of entries it has, or if it does its negligible? Link to comment https://forums.phpfreaks.com/topic/56615-solved-which-of-these-methods-are-faster-are-their-better-methods/#findComment-279649 Share on other sites More sharing options...
trq Posted June 21, 2007 Share Posted June 21, 2007 Databases are designed to be searched. They are very efficient at doing so providing your tables are indexed properly. Link to comment https://forums.phpfreaks.com/topic/56615-solved-which-of-these-methods-are-faster-are-their-better-methods/#findComment-279651 Share on other sites More sharing options...
rxbanditboy1112 Posted June 21, 2007 Author Share Posted June 21, 2007 Alright cool thanks for all the help ! Link to comment https://forums.phpfreaks.com/topic/56615-solved-which-of-these-methods-are-faster-are-their-better-methods/#findComment-279657 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.