Difference in Query Performance

Posted on 2004-10-21
Last Modified: 2013-12-24
I've been developing in ColdFusion for 5 years and have never come across this.  I have a cfquery that runs poorly for my needs (10 seconds plus)... but when I paste the SQL into Query Analyzer...  the same EXACT query runs in less then 2 seconds  (I am aware of SQL's caching ability, and have ruled that out as a possible explanation)  

Here's the deal... I'm really wanting to understand what's going on here.  I'm already aware of a number of different ways to solve this problem (such as creating a stored procedure or maybe even using query parameters) but that's not my goal here.  I've literally created thousands of queries, and have never had this happen.  Even if the performace of Query Analyzer and my ODBC connection aren't the same, they are always at least comperable.

Why the vast difference?

Question by:mts1701
    LVL 17

    Expert Comment

    Network performance??
    LVL 7

    Expert Comment

    What is the result set you are getting?  Is it just a single row or a lot of them?

    LVL 5

    Expert Comment

    Its possible the query analyzer is optimizing an inefficient query before processing it. Usually I believe that SQL is supposed to be optimized by default, but perhaps this analyzer is doing something that SQL does not.

    Just a thought. If you want to post the query, we could probably take a look at it for you.


    Author Comment

    Well, I rebooted the webserver, and the sql server... and the problem went away.   Perhaps it was network performance.  I still don't know for SURE what caused this, and as a result, I don't know precisely what to watch out for in the future.  If anybody has any further thoughts I'd welcome them.
    LVL 17

    Expert Comment

    network congestion...
    LVL 22

    Expert Comment

    Hi mts1701,
    may be your connections jdbc in cfadmin had some problem or operating system was slow for a moment ...

    LVL 35

    Accepted Solution

    I would guess part of the problem could also have been related to CF 5.  That also explains why a reboot helped solve it.

    Anyway, post here for PAQ/Refund:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Scale it in WD Gold

    With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

    A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    877 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now