Assuming you have a pretty standard loop something like this.

<cfloop ...>
        <cfquery name="foobar" ...>
        </cfquery>
</cfloop>

CF is not going to hang on to old versions of the query.  Each time through the 
loop, it is going to replace the old query with a new one unless you are doing 
something to give each version of the query an unique name.  I presume the old 
data will hang around until garbage collection comes along and cleans it up.

Then, unless you are doing something in a persistent scope and/or caching with 
the queries, once the page finishes, all the queries are going to go to garbage 
collection.

And finally, you may want look closely at why you are looping over a query.  I 
would hazard a guess that 8 out of 10 times, a looped over query can be 
restructured to be done in one pass combined with nested looping of the results.


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

"C code. C code run. Run code run. Please!"
- Cynthia Dunning



...-----Original Message-----
...From: Nick Baker [mailto:[EMAIL PROTECTED]
...Sent: Friday, January 21, 2005 11:08 AM
...To: CF-Talk
...Subject: Query proactive termination, is this necessary?
...
...What is the most graceful way to terminate a CFQuery once you have used
...the
...results, and free up resources?
...
...I use a query within a loop. Would it be more efficient to terminate the
...query at the end of each cycle (assuming there is a graceful way) and let
...CF reestablish the query or leave the query open?
...
...Background: I am guessing that you can tie up a lot of resources by not
...pro
...actively terminating queries?
...
...Thanks,
...
...Nick
...
...
...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:191387
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