Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Improving performance on a joined query

Author  Topic 

Newbie_87
Starting Member

1 Post

Posted - 2013-03-29 : 08:49:42
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
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-03-29 : 09:03:28
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
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-03-29 : 09:10:55
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
   

- Advertisement -