Skip to main content
July 13, 2006
Question

Monitoring Recordset Sizes

  • July 13, 2006
  • 8 replies
  • 617 views
My problem is that I’ve inherited some pretty bad code and I’m searching for queries that are causing Out of Memory errors because they are returning huge record sets. So what I need is a tool that will give me a list of queries that return record sets with greater than X records. I'm also on an old version of CF (5.1). Is there an easy way to do this in CF 5.1? Is there a way to see this in SQL Profiler?

Thanks
    This topic has been closed for replies.

    8 replies

    July 18, 2006
    Hmmm. Seems that the error message is correct. It seems that you can only do a collection loop over a COM object or a structure, at least that what the CF documentation says. But having said that, we have several OnRequestEnd pages for our apps that do a collection loop over a REQUEST scope variable. And I doubt if CF 5.1 is the issue.
    Inspiring
    July 18, 2006
    The example in the version 5 cfml reference manual shows octothorps and no quotes. So try

    <cfloop collection = #variables# item = "whatever">
    July 18, 2006
    Is the fact that I'm using CF5.1 the problem?
    July 18, 2006
    On the OnRequestEnd page
    July 18, 2006
    Where did you place this code? Application.cfm, OnRequestEnd.cfm or the action page?
    July 18, 2006
    I'm getting an error when I try this. When I try

    <cfloop collection = "#variables#" item="thisvar">. I get the following error:

    An error occurred while evaluating the expression:
    "#variables#"
    Error resolving parameter VARIABLES


    If I try

    <cfloop collection = "variables" item="thisvar"> (No pound signs) I get

    Loop error
    Invalid collection "variables" - must be a valid struct or COM object

    What am I doing wrong? Thanks!
    July 18, 2006
    Dan's suggestion is a good one, however I would put his code in OnRequestEnd.cfm. By the time OnRequestEnd is called, all the queries on a particular page have been run.
    July 18, 2006
    That sounds like a great idea!! How do I do that again? :-( I get the concept, but is there a Collection of Queries? I assume so since CF shows that in the debugging info, but how do I access it?

    Thanks for your help!
    Inspiring
    July 13, 2006
    I don't know the specifics, but, if you can figure out how to do something in your application.cfm, do something like this:

    <cfloop collection = "variables" item="thisvar">
    <cfif isquery(thisvar)>
    <cfif thisvar.recordcount gt 10>
    do something.

    closing tags.