cfqueryparam performance for static values?
I use cfqueryparam in pretty much all of my queries, but it got me thinking about performance. I usually have a mixture of dynamic and static values in the queries, but I also tend to wrap everything in a cfqueryparam. I know it's not necessary, but i am trying to figure out if it actually can hurt performance.
Example:
SELECT *
FROM myTable
WHERE id = <cfqueryparam value="#form.id#" /> AND
active = <cfqueryparam value="1" />
vs.
SELECT *
FROM myTable
WHERE id = <cfqueryparam value="#form.id#" /> AND
active = 1
Would putting the static value of "1" inside a cfqueryparam affect performance? Will the DB cached the execution plan more efficiently if I just hard-code the static values and not use cfqueryparam?
I am using CF8 on MS SQL Server 2008.
Thanks,
Bryan
