10774 - bad performance (index scan)

Hi experts

i have this query

select soh.AccountNumber, sod.LineTotal, sod.OrderQty, sod.UnitPrice,p.Name
from Sales.SalesOrderHeader soh
            Inner join Sales.SalesOrderDetail sod on soh.SalesOrderID = sod.SalesOrderID
            inner join Production.Product p
on sod.ProductID = p.ProductID
where sod.LineTotal > 1000;

That should create indexes, thanks

view execution plan attached.

sp_helpindex 'Sales.SalesOrderHeader'
index_name      index_description      index_keys
AK_SalesOrderHeader_rowguid      nonclustered, unique located on PRIMARY      rowguid
AK_SalesOrderHeader_SalesOrderNumber      nonclustered, unique located on PRIMARY      SalesOrderNumber
IX_SalesOrderHeader_CustomerID      nonclustered located on PRIMARY      CustomerID
IX_SalesOrderHeader_SalesPersonID      nonclustered located on PRIMARY      SalesPersonID
PK_SalesOrderHeader_SalesOrderID      clustered, unique, primary key located on PRIMARY      SalesOrderID

sp_helpindex 'Sales.SalesOrderDetail'
index_name      index_description      index_keys
AK_SalesOrderDetail_rowguid      nonclustered, unique located on PRIMARY      rowguid
IX_SalesOrderDetail_ProductID      nonclustered located on PRIMARY      ProductID
PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID      clustered, unique, primary key located on PRIMARY      SalesOrderID, SalesOrderDetailID

sp_helpindex 'Production.Product'
index_name      index_description      index_keys
AK_Product_Name      nonclustered, unique located on PRIMARY      Name
AK_Product_ProductNumber      nonclustered, unique located on PRIMARY      ProductNumber
AK_Product_rowguid      nonclustered, unique located on PRIMARY      rowguid
PK_Product_ProductID      clustered, unique, primary key located on PRIMARY      ProductID
execution-plan.png
exution-plan.csv
enrique_aeoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
The only thing you can do here is to create a covering index on SalesOrderDetail. Just enable the retrival of the actual execution plan. SSMS recommends an index to create.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
enrique_aeoAuthor Commented:
SSMS suggest
USE [AdventureWorks2012]
GO
CREATE NONCLUSTERED INDEX IDX_SOD
ON [Sales].[SalesOrderDetail] ([LineTotal])
INCLUDE ([SalesOrderID],[OrderQty],[ProductID],[UnitPrice])
GO

seen in plan execution using the new index.
You can not do anything else? to improve scan
execution-plan-better.png
ste5anSenior DeveloperCommented:
No. Just think about the predicates you have in your query. Don't forget the columns in the JOIN condition. A covering index is normally the optimum. Just keep in mind that an index requires space, and a covering index requires more spaces.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.