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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 t-sql 2008 performance issue
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jassie
Constraint Violating Yak Guru

295 Posts

Posted - 09/14/2013 :  17:43:00  Show Profile  Reply with Quote
I am having a performnace problem is a sql server 2008 sql. The stored procedure does a full table scan when one of the @state
or @zip paramteres are used. The dba says he will not put an index on the state and zip columns since this is the only sql that uses state and zip cocde. The sql look like the following:

select cs.person_id,cs.cust_id,cs.customer_name,cs.address1, cs.address2, cs.city, cs.cuct_id,z.product_name,z.product_description
from customer_table cs left join view1 v1 on v1.cust_id = cs.cust_id
left join
(select product_id,product_name,product_description from product_table p on p.iventory_id = v.iventory_id
where @prod_quantity <= p.supply_on_hand) z on z.person_id = c.person_id where @zip = Cs.zip or @state=cs.state

Thus can you tell me what I can do to make this sql run faster?
  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.03 seconds. Powered By: Snitz Forums 2000