SQL DMV linking Index Usage to Stored Procedure Usage - sql-server

I'm auditing & cleaning some SQL 2008 R2 Boxes.
I'm doing a lot of work with:
sys.dm_db_index_usage_stats (Index usage)
sys.dm_exec_procedure_stats (Procedure usage)
These DMVs provide a lot of good performance information.
What I need is a way of linking the results together. i.e. How do I figure out which Stored Procedures are using which indexes?
I've been shredding the XML in the plan cache, but this is very inefficient, does anybody have a better solution?

Use system reports.
In Management studio right click on server or specific database. Select Reports and then Standard reports and select Object execution statistics.
I'm sure you are able to catch queries (if it's necessary) with SQL Server Profiler.

Related

Best way to perform distributed SQL query and joins, calling from .Net code

Here's my scenario:
I have to query two PeopleSoft Databases on different servers (both are SQL Server 2000) and do a join of the data. My application is a .Net application (BizTalk).
I'm wondering what the best option is with regards to performance?
use standard select queries to get data
and do the join in memory (e.g. LINQ) for example
generated complex dynamic queries using LINKED Server, e.g.
select blah
from Server1.HRDB.dbo.MyTable1
left join Server2.FinanceDb.dbo.MyTable2
use standard select queries to get the data into an intermediate / staging sql server database and do my queries / joins on this database instead.
should I consider using SSIS? ( are there features here that might be better than doing an in-memory, e.g. LINQ? )
I wish I could use stored procedures on the source database, but the owners of the PeopleSoft database refuse it
The main constraints we have is that the source database is old (SQL Server 2000) and that performance of the source database is paramount. Whatever queries I run on this server must not block the other users. Hence, the DBAs are adamant about no Stored Procedures. They also believe that queries involving Linked Servers will trump (i.e. take higher priority) to other queries being run against the the database.
Any feedback would be greatly appreciated.
Thanks!
Update: additional background information on the project
We are primarily integrating PeopleSoft databases (the HR and Finance) into another product. Some are simple - like AccountCode and Department. Others are more complex, like the personal data, job, and leave accrual. Some are real-time, other's are scheduled, and other's are 'batch' (e.g. at payroll runs).
Regardless, we have to get source data out of PeopleSoft database -- and my hope had been to let the (source) database do the 'heavy' lifting by executing SQL Queries. I don't really want BizTalk, or SSIS, or C# LINQ to be the ones doing the transformations/filtering.
Definitely open to suggestions.

Can somebody give me detailed construction how to find table scans with Sql Profiler?

I'm using SqlServer 2008. A usefull link is also ok. I've found some links, but since I'm not an expert with Sql Profiler, I can't seem to find how I would do this.
By the way, some data is retrieved with Stored Procedures, but others are done with sql in the .NET server layer.
In Management Studio, go to the Query portion of the menu and go down to "Include Actual Execution Plan", this will create a new tab when you execute a new query.
Edit for SQL Server 2008
If your doing SQL Profiler, turn on the trace Scans:Scan Started and Scans:Scan Ended

Convert Access queries to SQL Server views when using DTS

I'm using DTS to import data from an Access database to SQL Server 2005. It seems that DTS imports Access queries as tables instead of views, which won't work for me. Is there any way around that?
You can choose to not include the saved queries. (at least you can when using the SSMA - I suggest you use this in place of DTS anyway…it tends to do a better job).
you can find it here:
http://www.microsoft.com/sqlserver/2005/en/us/migration.aspx
It is not clear if you going to continue to use ms-access as the front end here or not?. If you plan to continue using access then you really don’t need to convert those saved queries (views) up to sql server anyway. Most of the saved queries in access will work as before (now with linked tables to sql server).
You only need change/fix those saved quires that run slow. In other words most queries can continue to be used and run as is. It is only the slow ones and especially the ones with aggregate functions (sums, totals etc that process many records, but produce few rows). This types of queries really benefit from being moved up to sql server as a view (you then link to that view from ms-access).
If your not keeping any part of ms-access, then I am afraid there no automated tool for those queries. In these cases I just do a cut + paste from ms-access right into the management studio view builder. Most queries require very little modifications.

Query to get time consuming sql statements in SQL Server

How can we get information regarding poorly performing sqls(taking too much time for execution)
Does MS SQL server maintains tables/views (Similar to v$sql in Oracle) for storing sql queries.
I Use the SQL Profiler to collect statistic data wich I then can use to nail down where there are need to do some work, tweak indexes and so on.
Here are some tips about monitoring with Profiler:
http://www.developer.com/db/article.php/3490086
http://vyaskn.tripod.com/analyzing_profiler_output.htm
take a look at sys.dm_exec_query_stats and this page. SQL Server 2005+ only.

Is there a dynamic management view in SQL Server 2005 that pertains to column statistics?

The dynamic management views of SQL Server 2005 can give usage information about table indexes. Is there a similar method for getting usage information about column statistics? In specific, I'm curious if some of the older column statistics I've created are still being used. If not, I'd like to delete them.
no there isn't. there are however sys.stats_columns and sys.stats catalog views

Resources