What’d be the most effective and efficient sql query to grab an article and the comments?
It’d be two tables (articles, comments.) Would it be best to have it in one SQL query or two SQL querys? Speed is the main concern.
Thanks in advance
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depending on how large your records are to work with, there shouldn’t be a huge noticeable difference, if at all negligible, in speed whether its one query or two.
Personally, if it can get done in one query and you don’t have to sacrifice readability, I would opt for one query. As a heads up, I would try to worry about performance when it is time to worry about performance.