Testing Queries, OPTION(RECOMPILE) and TOP %

  • Stefan Krzywicki (12/8/2011)


    Grant Fritchey (12/8/2011)


    Stefan Krzywicki (12/8/2011)


    Grant Fritchey (12/8/2011)


    Stefan Krzywicki (12/8/2011)


    Brandie Tarvin (12/8/2011)


    Have you cleared the cache to make sure it isn't still trying to pull info from the cached copy of the proc?

    It is a production server, best I can do is OPTION(RECOMPILE) (I think). Clearing the cache would force new execution plans for everything and I don't want to do that.

    We're talking 2008, right? You can DBCCFREEPROCACHE (plan_handle). That'll get that one plan out.

    2008 R2

    How do I get the plan_handle?

    Lots of joy to be had from DMOs:

    SELECT der.plan_handle

    FROM sys.dm_exec_requests AS der

    CROSS APPLY sys.dm_exec_sql_text(der.sql_handle) AS dest

    WHERE dest.text LIKE '%some recognizable string from my query%'

    --and yeah, if you can make that text search an = or LIKE 'xx%'

    --you're better off.

    Get Tim Ford's & Louis Davidson's book for a great overview.

    Thanks

    I have a book on DMVs on my nightstand that I was just about to start reading, it is the one by Ian Stirk. I'd seen him give a presentation on DMVs a few years ago and he's the one that introduced me to DMVs, so I got his book when it came out.

    Cool. I don't know that book at all. More to learn.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Hmmm... I'm stumped. I'm not sure why that TOP is in there. But, I don't know that I'd sweat it at the moment with all those clustered index scans to worry about.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Grant Fritchey (12/8/2011)


    Hmmm... I'm stumped. I'm not sure why that TOP is in there. But, I don't know that I'd sweat it at the moment with all those clustered index scans to worry about.

    The scans are the next thing I'm going to tacke. I'm doing this part first because it doesn't involve creating new indexes yet. I have to make sure it is worthwhile to create those indexes before I do it and I don't have a test or dev machine to do it on.

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    It’s unpleasantly like being drunk.
    What’s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply