Results 1 to 6 of 6

Thread: cost estimate

  1. #1
    Join Date
    Apr 2003
    Posts
    4

    Question Unanswered: cost estimate

    Hi, all
    I am writing a midware for some heterogeneous data sources, and I need to do some cost estimation to some SQL queries before they are sent to an underlying SQL server.
    My question is, is it possible to get the cost estimates of queries from SQL server by some API ? If not, can I get the numbers of distinct values for attributes from the system catalogs ? and how about other statistics, such as cardinality, selectivity?

    Thanks a lot!

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Use QUERY EXECUTION PLAN from Query analyzer and also PROFILER to assess the query process time and indexes.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  3. #3
    Join Date
    Apr 2003
    Posts
    4
    Originally posted by Satya
    Use QUERY EXECUTION PLAN from Query analyzer
    Yes, I can see the execution plan graphiclly displayed in Query analyzer.
    But is there a way to use that information in my application?
    BTW, what is PROFILER?

  4. #4
    Join Date
    Feb 2003
    Posts
    15
    use:

    set showplan_all on

    it will return what I think you're looking for, in table-based format, which you can iterate through and do what you wish with.

  5. #5
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Thanks strader.

    PROFILER is tool used to trace the events on SQL Server, which is best used to know slow running queries and process.

    Refer to books online for more information.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  6. #6
    Join Date
    Apr 2003
    Posts
    4
    Originally posted by Satya
    Thanks strader.

    PROFILER is tool used to trace the events on SQL Server, which is best used to know slow running queries and process.

    Refer to books online for more information.
    Thanks a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •