If by dynamic queries you mean:
select table.column
from table
where table.column = #dynamic_var#
then yes, pick a constant. sql 7's engine caches sql statements by the
language they use, not the var's they use. SQL will see this query and the
previous query differently:
select column
from table
where column = #dynamic_var#
however, if you are dynamicaly building your statements thusly:
select table.column
from table
where table.column = #dynamic_var#
<cfif something>
and othercolumn > 5
</cfif>
you will have optimizing issues. it has been my experience that you should
optimize based on statements that will always be present at the time of
execution.
regards,
Alexander Sicular
Director, Information Technology
Neurological Institute of New York
New York Presbyterian Hospital
[EMAIL PROTECTED]
212.305.1318
| -----Original Message-----
| From: Ian [mailto:[EMAIL PROTECTED]]
| Sent: Tuesday, April 04, 2000 10:57 AM
| To: [EMAIL PROTECTED]
| Subject: Optimizing dynamic SQL queries
|
|
| I keep reading that I should make sure that all of my queries
| are optimized
| and indexed and I know that SQL 7 comes with a query
| optimizer. What I don't
| understand is how you can build indexes and optimize the
| dynamic queries that
| CF uses.
|
| Do I pick a constant in place of the variable and optimize
| against that and
| then put the variables back in after optimization?
|
| Thanks,
|
| Ian
|
| ____________________________________________________________________
| Get your own FREE, personal Netscape WebMail account today at
http://webmail.netscape.com.
----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.