Compilation Locks

  • Comments posted to this topic are about the item Compilation Locks

    Steve Jimmo
    Sr DBA
    “If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan

  • This was removed by the editor as SPAM

  • Good question, i learned some thing out of it.

  • Good question. Had to read up on it and then even got it right 🙂

    --------------------------------------------------------------------------
    A little knowledge is a dangerous thing (Alexander Pope)
    In order for us to help you as efficiently as possible, please read this before posting (courtesy of Jeff Moden)[/url]

  • While I agree that it is a good question, I think that there is a mistake in the answers. Since the question states that it is for SQL Server 2005, the fully qualified name of the object has nothing to do with the object’s owner. Instead it has to do with the object’s schema.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Thanks, Steve. Nice question to remind of us one more reason (hah! as if we'd need one!) to always fully qualify our object names.

    Small mistake in the explanation - is I read the referenced KB article, the compile lock occurs when both conditions are met, i.e. the SP is run by a non-owner, AND without using the fully qualified name. The explanation usees "or" instead of "and".


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • I did a fair amount of background reading on this question and it led me to several light bulb moments about my current coding practices. Thanks for a great question and a little bit of education first thing in the AM.

  • Thank you for the great QOD! I really do appreciate the reminder to fully qualify names and reduce the work required by SQL Server. In this case, the lack of name qualification (laziness) causes SQL Server to place a compile lock on a potentially heavily used stored pocedure and substantially increasing runtimes.

  • Explanation is corrected.

  • This is a very good question, thank you Steve.

    Fully qualified objects names is a must, not subjected to any second guessing. This is a very pathetic scenario when due to someone's ignorance the database engine is forced to acquire compile lock thus potentially causing block contention just to determine that recompilation is not necessarily required.

    Oleg

  • I'm a bit confused. Several of you suggested using "fully qualified names". But this usually refers to using all 4 parts: Server.Database.Schema.Object.

    Is that what you suggest we should use everywhere in code?

    --Vadim R.

  • rVadim (5/11/2010)


    I'm a bit confused. Several of you suggested using "fully qualified names". But this usually refers to using all 4 parts: Server.Database.Schema.Object.

    Is that what you suggest we should use everywhere in code?

    That was a bit unclear of "several of you" (of which I am one).

    In this context, "fully qualified" should be read as "schema-qualified". My apologies.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Great question. I learned something new, which is always great!

  • Great question. I learned something good today.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • thanks..:-) good question

Viewing 15 posts - 1 through 15 (of 27 total)

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