While using Toxi solution, how must i choose the tags for any certain "Bookmark" (to help keep the Scrumptious theme):
I'm able to either:
1) Participate in just one query:
choose bookmark.title, bookmark.url, ( Choose group_concat( tags.title ) as tagNames FROM taggings INNER JOIN tags ON taggings.tagId_fk=tags.tagId WHERE taggings.bookmarkId_fk = bookmarks.bookmarkId_fk ) from bookmarks where bookmarks.id=1 ^^ That provides title url tagNames A bkmrk http://url.com tag1,tag2,tag3
2) Use two queries: someone to retrieve the bookmark id's to show, then another to retrieve the tags for individuals bookmarks. The outcomes may then be merged in PHP.
So really this is: Generally efficiency/database load-smart is it more beneficial to complete more joining in one query or multiple queries?
How can you make that type of decision? Or would you not consider it until load leads to a problem?
Server side is much more efficient.
In the two cases, the server must read all the tags.
Should you bring these to PHP, they must all travel within the wire and PHP needs to fiddle together.
Should you choose them around the server, the finished answer (more compact) comes within the wire ready for PHP to pass through up towards the UI.