SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Improving performance on a joined query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Newbie_87
Starting Member

1 Posts

Posted - 03/29/2013 :  08:49:42  Show Profile  Reply with Quote
Hi,

I'm in interested in learning about database management and was just wondering if anybody can help me with the following query.

I want to improve the performance of a joined query that retrieves over 43000 rows of data. The following syntax retrieves the data needed.

SELECT ow.ForeName, ow.Email, pr.Type 
FROM dbo.Owners ow
INNER JOIN dbo.PropertyType pt ON pt.OwnerID = ow.OwnerID
INNER JOIN dbo.Properties pr ON pr.TypeID = pt.TypeID
WHERE pr.Type = 'Penthouse'


What would be peoples suggestion about indexes and where to create them as I'm not sure where to use them to improve the I/O cost and the CPU Cost.

bandi
Flowing Fount of Yak Knowledge

India
2169 Posts

Posted - 03/29/2013 :  09:03:28  Show Profile  Reply with Quote
use Statistics IO setting.... You can get to know the io physical and logical reads

SET STATISTICS IO ON
GO
SELECT ow.ForeName, ow.Email, pr.Type
FROM dbo.Owners ow
INNER JOIN dbo.PropertyType pt ON pt.OwnerID = ow.OwnerID
INNER JOIN dbo.Properties pr ON pr.TypeID = pt.TypeID
WHERE pr.Type = 'Penthouse'
GO
SET STATISTICS IO OFF

Note: You will get to know the cost of qury and where it is taking much time by enabling execution plan
In SSMS, Press Ctrl+M to enable execution plan
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2169 Posts

Posted - 03/29/2013 :  09:10:55  Show Profile  Reply with Quote
Follow this link for Indices....
http://blog.sqlauthority.com/2010/03/09/sql-server-improve-performance-by-reducing-io-creating-covered-index/


Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000