|
Posted by jinxidoru on 11/22/06 08:22
You are generally going to get a performance gain from grouping smaller
queries into one query if possible. Be careful though, because this is
not always the case. There are situations where the cost of the joins
and the possible locking of the tables may decrease performance. These
cases are rare though.
Now, just because you get better performance does not mean that you
should go out and change your code immediately. You mentioned that
your code is currently easy to maintain. This carries a lot of value.
There are certain situations where speed is critical and must be
achieved at any cost, even if it increases the difficulty of the code
maintenance. There's always that balance.
Of course, do not think that the best performance is only achieved
through the most cryptic code. There might be a way to get the best of
both worlds. Is there a way that you can use the functions you have
right now to, rather than perform queries, aggregate onto a query. I
have done this many times where a function call does not generate a
query of its own but simply adds to a query that I am generating. Once
I have called all my necessary methods, I then run the query and
extract the data.
Hopefully this has been somewhat helpful.
Navigation:
[Reply to this message]
|