ColdFusion Muse

Cached Plans and Static Variables

Mark Kruger December 16, 2008 11:12 AM ColdFusion, MS SQL Server Comments (2)

Regarding Static Variables in SQL Statements

In my last post I indicated that even static variables passed to SQL statements should be bound using Cfqueryparam. My understanding was that the DB server could only create cached plans if all the variables in the statement were bound - so I believed that a statement like the following:

<cfquery>
    SELECT fname, lname
    FROM    users    
    WHERE    active = 1
</cfquery>
...Could not benefit from the execution plan cache. In the comments of the previous post a number of people disputed this idea, saying that if the variable is static it will cause the execution plan to be cached. Now, Chris Secord has given me a tip on how to prove that I am wrong.

Read More
  • Share:

2 Comments

  • pasta oyunlar?'s Gravatar
    Posted By
    pasta oyunlar? | 12/27/08 3:18 PM
    Hopefully the next version of ColdFusion will have the ability to utilize new versions of the Ext JS as they come out. But, until that happens we will have to rely on the great work of people like Jason.
  • giydirme oyunlar?'s Gravatar
    Posted By
    giydirme oyunlar? | 2/9/09 5:09 PM
    Hopefully the next version of ColdFusion will have the ability to utilize new versions of the Ext JS as they come out. But, until that happens we will have to rely on the great work of people like Jason.