Adhoc - Prepared queries

  • Hai,

    Can anybody explain what is the difference between Adhoc and prepared statements in sql

     

     


    subban

  • An example of a prepared query is a stored procedure. This is precompiled on the server in advance of execution and therefore has performace benefits (e.g the execution plan is optimized in advance of running the sp).

    An adhoc query is a generic submission of sql to the server that, because it is not defined in advance of the request to execute (unlike a sp) must be evaluated by the optimizer before execution (and before each subsequent execution).

    Hope this helps - I am sure others will offer additional insights.

Viewing 2 posts - 1 through 1 (of 1 total)

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