Q: Do you have a performance problem related to database queries?
Yes? A: Less than you have now.
No? A: The exact number you have now.
If it does not break, do not correct it.
While refactoring and optimizing to save a few milliseconds is a fun and intellectually useful way for programmers to waste time, it is often a waste of time.
In addition, changing the code to combine database queries may be related to the simplicity and convenience of maintaining your code. That is, although it is technically possible to combine several requests into one, which may require eliminating the conceptual isolation of business objects in your code, which is bad.
source share