Is here join query best?
I have two tabes: tb_videos, tb_video_tags
tb_videos has id,title,thumbnail,description and
tb_video_tags has id,video_id,tag columns.
Now i want to get video details and it tags through id.
Here which one is better? Join query or two simple select query for each开发者_StackOverflow社区 table
Join is the way to go, it is the natural way of relating information of a table to the other one from SQL perspective, will make your application code cleaner and surely the performance will boost since there won't be multiple network roundtrips and queries to the database server.
Your join will reduce round trip times and the amount of calls to the database by bringing back everything in one request. In a server with very high load you would see a lot of performance gain by using the join.
精彩评论