i have a List and want to select rows by their ID. are this affect the queries performance and better alternate to do that.
Share
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.
If you have a list and do the following kind of query :
for each one of the items of your list, you’ll end up doing a lot of queries — which, as you can guess, is not that good for performances.
An idea might be to group those queries, like this :
To do less queries : only one here, instead of three.
This means a bit more logic in your code, to get the results from the database, of course ; but it will generally help, when it comes to performances.
Note though : you should not use too much ids in a single
in()clause — which means you might end up doing several queries — each one working on several ids.