Skip to main content
January 16, 2007
Question

Help Reducing number of Queries

  • January 16, 2007
  • 1 reply
  • 462 views
I have a page that does way too many queries. I have reduced the execution time by using Query or Query.
I'm wondering if there is any other methods given what I've got that can reduce processing/query time.

Any suggestions would help.
    This topic has been closed for replies.

    1 reply

    mvierow
    Inspiring
    January 16, 2007
    Goodness.. well you could do something like this in "GETRESOURCES"

    WHERE MASTER_MEMBERS.USER_ID IN (#SESSION.PERSON_VIEW#)

    But you'll need to make sure each value is surrounded by single quotes unless USER_ID is numeric.

    Also, does GETASSIGNMENT and GETHOL really need to be separate? If MSTRHOL is only referenced once, there really isn't any reason to use QoQ. But if you must, and the result set is small, you might consider renaming "MSTRHOL" to "application.MSTRHOL" and place it in the application file so that the query will be stored in the application scope (make sure that your cfapplication/application.cfc is properly configured to allow this).

    But to be completely honest I would recommend using a different datatype all together rather than using QoQ. Pull the data using a query then maybe put it into a well formed array/structure. Then when you get down to displaying the data you can loop through the array rather that nesting all of these queries inside cfloops. There are many benefits to this, but probably the most benefitial would be the ability to simply cfdump the entire array and see exactly what it is that you are working with. With all of the cfloops and cfsets, you're really making it tough on anyone to come in there and make any kind of change, even with the comments.
    January 16, 2007
    Thanks for the info. Do you have an easy trick to setup the string..

    a1234,b5678,c9101 ..... ect for the
    WHERE MASTER_MEMBERS.USER_ID IN (#SESSION.PERSON_VIEW#)
    to put the single quotes around it?
    mvierow
    Inspiring
    January 17, 2007
    Sure.. good luck