When issuing a query against a database, at what depth of an object graph does it actually become more performant to just use multiple trips instead of one huge query?
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.
Relational Databases (assuming you are asking about them) do not understand/view the Objects/Entities in the middleware. As such, they will not know at what depth your queries are originating from. They all run in a stateless declarative fashion.
Having said that, in general, several simple queries in the place of a large query does not seriously hurt the performance provided (1) the connections are reused via pooling (2) the connection open-close lifecycle is short.
A large query that gets a lot of data is also desirable provided the underlying database is well tuned and well indexed. It reduces the traffic, uses less connections and aids in concurrency.