Skip to main content
Participant
January 5, 2009
Question

Does stating username & passsword in CFQUERY affect performance?

  • January 5, 2009
  • 2 replies
  • 612 views
I'm working on a site that has been having serious database performance issues. One thing I noticed about the code is that the previous dev specifies the username and password in the CFQUERY tag.

I normally just rely upon those settings at the CF admin datasource level. Does having that on every CFQUERY negatively impact performance? Am wondering if it has the CF server opening redundant connections to the SQL server.
This topic has been closed for replies.

2 replies

Participating Frequently
January 12, 2009
quote:

Originally posted by: haroldprinter
I'm working on a site that has been having serious database performance issues. One thing I noticed about the code is that the previous dev specifies the username and password in the CFQUERY tag.

I normally just rely upon those settings at the CF admin datasource level. Does having that on every CFQUERY negatively impact performance? Am wondering if it has the CF server opening redundant connections to the SQL server.



Even if specifying the username/password does impact the query it's marginal at best. If you're on a dedicated server, i.e. there are no other clients on that machine nor are there any security concerns then including the user/pass in the DNS would be preferred, however if you are in a shared environment the very best practice is to save the database name, username, and password as variables in your application.cfm and reference those variables in each query you make. That way, should the code for your pages every become exposed all that web users will see is the variable names, which is of much less use to malicious users than the actual user/pass info.
Inspiring
January 6, 2009
You can test this with gettickcount, cfloop, and cfquery.