I think the size of the query and structure would be an important factor, as well as how many loop iterations are done. Often I lean towards using structures if I need to look up data frequently because the syntax is cleaner. There is also the array method of accessing queries like query.column[row], which might help with something. Whatever you are trying to do might have other solutions as well, such as keeping track of items as they are encountered using separate variables.
QoQ doesn't have the reputation of being fast, although neither does turning a query into another data type. Turning a query into another data type also increases the RAM usage since data is stored twice. Either way, my guess would be that the difference in speed would be unnoticeable to the end user, so it might come down to personal preference and ease of maintenance. -Mike Chabot On Tue, Jul 13, 2010 at 12:19 PM, Michael Dinowitz <mdino...@houseoffusion.com> wrote: > > I've got a loop which will need to look up a piece of data on each > iteration. The data is standardized so there is really just one call > to the database (outside the loop). I can either do a query of queries > on each iteration or I can turn the query into a structure and do a > structure lookup (structkeyexists, etc) on each iteration. I'm > assuming that the struct lookup will be faster/more efficient even > after having to turn the query into a structure. > Anyone have an opinion on this? > > Thanks > > -- > Michael Dinowitz > Lead Author - Adobe Coldfusion Anthology > http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335299 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm