> One of the most used bad practices is the use of extra 
> queries to accomplish getting data. That is the NR.1 cause of 
> bad application performance no matter what language you are 
> programming in. Prevent new database connections at all costs 
> where possible, seriously.

I would disagree with this statement, as written. The number one cause of
bad application performance, in my experience, is inefficient database
access. However, this isn't as simple as "extra queries". It covers all
sorts of issues such as looping over queries to run other, related queries
as in your example is one common problem, but it also covers trying to
relate largely unrelated things within a single query - that doesn't perform
well either. In my opinion, based on what I've read in this thread so far,
attempting to fetch authors and articles in a single query would fall within
that category.

It's also worth pointing out that, by default, all queries within a single
page using the same datasource attributes will use the same database
connection. CF (and JDBC) pool and maintain database connections. So,
there's little or no overhead to running two queries within a page as
opposed to a single query, all other things being equal.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
phone: 202-797-5496
fax: 202-797-5444


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183854
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to