Showing posts with label queries. Show all posts
Showing posts with label queries. Show all posts

Tuesday, March 27, 2012

Estimated Query Plan

Hi,

I am writing a client application that shows estimated queries plans and statistics. I know how to obtain estimated plans by using SQL Server Management Studio. But is it possible to obtain by using database functions?

I have found sys.dm_exec_query_plan, but it seems that this function can only be used for executed (or executing) queries...

Thanks

SET SHOWPLAN_XML ON

go

exec YourSP

go

SET SHOWPLAN_XML OFF

go

|||

I do not want to obtain the execution plan for a stored procedure. I do want to use a stored procedure (that may be invoked by a client application) to obtain the execution plan for a user-submmitted query. (It is just like SQL Manager Studio does).

Thanks

Friday, March 9, 2012

Errors and Warnings

Running SQL 2005, SP1 on WIN2K3.
I am in the midst of troubleshooting High CPU and have identified several
queries that could use some performance tuning.
However, in the midst of performing some traces in Profiler, not wanting to
rule anything out, I included some of the "Errors and Warnings" events.
One Event Class that occurs very often is an Event Class of "User Error
Message" with:
TextData = "Changed database context to '[Name of a database]', and
TextData = "Changed language setting to us_english."
Because of the shear number of these messages occuring, I was wondering if
this is an error to be concerned about. Any thoughts?
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200708/1It is more of an informational message but you may want to find out why they
are changing these. Normally you would set these in the connection and I
wouldn't expect them to pop up otherwise but I never trace that event.
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"cbrichards via SQLMonster.com" <u3288@.uwe> wrote in message
news:7779563dc14d7@.uwe...
> Running SQL 2005, SP1 on WIN2K3.
> I am in the midst of troubleshooting High CPU and have identified several
> queries that could use some performance tuning.
> However, in the midst of performing some traces in Profiler, not wanting
> to
> rule anything out, I included some of the "Errors and Warnings" events.
> One Event Class that occurs very often is an Event Class of "User Error
> Message" with:
> TextData = "Changed database context to '[Name of a database]', and
> TextData = "Changed language setting to us_english."
> Because of the shear number of these messages occuring, I was wondering if
> this is an error to be concerned about. Any thoughts?
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200708/1
>