[geeklog-devel] Coding standards clarification
info at heatherengineering.com
Thu May 24 09:16:24 EDT 2007
On 2007/05/24, at 21:05, Peter Roozemaal wrote:
> Heather Engineering wrote:
>>> Yes, because it is hard to maintain because it is ugly and it has
>>> so many side effects. Make multiple trips to the database for
>>> code clarity. Speed it up only if you do tests that show it is a
>> That's a different question, but actually one I wanted to ask. Is
>> it usually better to make one big query, or several smaller ones?
>> Performance-wise, which is better? I was under the impression it
>> was generally better to combine into as few queries as possible.
> For performance it is generally better to reduce the number of round
> trips to the database; if you know in advance that you are going to
> several records from the same table, get them all at once. If you need
> unrelated records from different tables, just do two queries.
> joins are fine; don't cruft one complex SQL statement where two simple
> ones are the straight-forward implementation. (Parsing and optimising
> complex SQL adds to the database load.))
Thanks - that's what I wanted to know.
> My gripe: avoid "SELECT *"; instead specify the fields you need for
> query. You'll reduce the load on your network (and memory use in web-
> and database server.) I've seen memory overflow on the admin story
> when it loaded more than 32Mb of body texts. It only needed titles and
Yup, I'm on to that one.
More information about the geeklog-devel