optimizing the stored procedure with indexing

Saturday, May 3, 2014

hi i have a stored procedure like this:



ALTER PROCEDURE [dbo].[IBS_fetchrequested]
@tid integer =null,
@Tbaroced dbo.TBarcode readonly

as
begin
SET NOCOUNT ON;
if (select COUNT(*) from Khanger_tbl where tid=@tid and requested=1 and delivered=0)>0
begin
select t.TBarcode,k.HBarcode as keyloc from Khanger_tbl k
inner join transaction_tbl t on k.transactid=t.transactID
where tid=@tid and requested=1 and delivered=0 and t.Tbarcode not in(select carid from @Tbaroced) and t.status=3
end
end


in my data base around 2 lack record..if i give indexing to tid in the Khanger_tbl my stored procedure performance will increase? how i can increase these stored procedure performance? any other Technic? any help is very appreciable?







http://ift.tt/Sn2sS8