lastdoor Posted February 2, 2011 Share Posted February 2, 2011 Hello A question popped up in my head, while I was designing my database (this is both php and SQL thought). The scenario is that an item can have many categories. Yet the categories are finite (<100 let's say). I have no problem making a many to many link table. Yet I was wondering if the finite categories would necessitate this method. My thought is - make the categories table a default array and match it against a queried item (containing an array of category IDs) with an array_intersect. Is this efficient, silly, or a variable scenario? Thanks for any insight. Link to comment https://forums.phpfreaks.com/topic/226424-efficiency-array_intersect-vs-many-to-many/ Share on other sites More sharing options...
requinix Posted February 2, 2011 Share Posted February 2, 2011 Much less efficient. Database systems are designed for that kind of table structure. Let them do their magic. Link to comment https://forums.phpfreaks.com/topic/226424-efficiency-array_intersect-vs-many-to-many/#findComment-1168707 Share on other sites More sharing options...
lastdoor Posted February 2, 2011 Author Share Posted February 2, 2011 Thanks, I had a hunch that was the case - but not a lot of relevant experience to put the question at ease. Link to comment https://forums.phpfreaks.com/topic/226424-efficiency-array_intersect-vs-many-to-many/#findComment-1168709 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.