2 Select or 1 Join query? 2 Select or 1 Join query? database database

2 Select or 1 Join query?


The first one. It's only a single round trip. It requires a little processing to collapse the rows of authors into a comma-separated list like you want but that's basically boilerplate code.

Separate related queries are a bad habit that will kill your performance faster than most things.


The best option is to run speed tests on your own server. Depending on how often the different tables are accessed together and apart, either one could be faster.

This has been answered in depth before: LEFT JOIN vs. multiple SELECT statements


The first one, and especially if you have an index on author.book_id. A clostered index would be best if you have many authors pr book and it's possible, else a non-clostered would also help you a lot.