I can't remember who posted it, but someone tested this and found that
using a CFQueryparam for NON dynamic variables made the query run
faster. I think he was even using it on anything useful:

WHERE
        1 = <cfqueryparam value="1" cfsqltype="CF_SQL_INTEGER" /> 

.... Found that to be faster than not using it. I wish I could remember
that link!



......................
Ben Nadel
Certified Advanced ColdFusion Developer
www.bennadel.com
 

-----Original Message-----
From: Richard Dillman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 11, 2006 1:23 PM
To: CF-Talk
Subject: Cfqueryparam use

I know that a pounded variable in a cfuery alwasy should be
cfqueryparam'd And ive herd it actually makes the Query run faster.

but what about non pounded variables
take the folowing query:
<cfquery name="ListFams" datasource="#dsn#" username="#dbusername#"
password="#dbpassword#">
 SELECT Child_ID, Firstname, sibs
 FROM tbl_children
 WHERE DispWithFamily = 1 and Availability = 1 AND sibs = <cfqueryparam
value="#form.sibs#" cfsqltype="CF_SQL_INTEGER" />  ORDER BY sibs DESC
</cfquery>

Would the query gain a speed benifit like this?
<cfquery name="ListFams" datasource="#dsn#" username="#dbusername#"
password="#dbpassword#">
 SELECT Child_ID, Firstname, sibs
 FROM tbl_children
 WHERE DispWithFamily = <cfqueryparam value="1"
cfsqltype="CF_SQL_TINYINT"
/>
 AND Availability = <cfqueryparam value="1" cfsqltype="CF_SQL_TINYINT"
/>  AND sibs = <cfqueryparam value="#form.sibs#"
cfsqltype="CF_SQL_INTEGER" />  ORDER BY sibs DESC </cfquery>

hard to tell with only 400 records,,, but in a years time this table
should be upwards of 300,000 records  so every bit of speed i can get...

--
--
Richard Dillman
[EMAIL PROTECTED]
(317) 916-8341

"...the very powerful and the very stupid have one thing in common, they
don't alter their views to fit the facts, they alter the facts to fit
the views."




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256381
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to