Sunday, February 19, 2012

index ..optimize query pls

hi
the below table used in the query doest have any indexes..
i've created non clus index on status and barcode..
will this optimize the query,or should i go for covering index.
**should i create index on temp table also..
UPDATE MMMailCust
SET status = 'Approved'
FROM MMMailCust a
INNER JOIN #tmpOneMMReason b ON (a.barcode = b.barcode)
regardsYou are only involving status and barcode on the one table, how wide is your
temp table or do you have to use it?
--
Ray Higdon MCSE, MCDBA, CCNA
--
"sanjay" <anonymous@.discussions.microsoft.com> wrote in message
news:F02BC517-5A6E-438C-B2EE-F8103DA3AEF8@.microsoft.com...
> hi,
> the below table used in the query doest have any indexes...
> i've created non clus index on status and barcode...
> will this optimize the query,or should i go for covering index..
> **should i create index on temp table also...
> UPDATE MMMailCust
> SET status = 'Approved'
> FROM MMMailCust a
> INNER JOIN #tmpOneMMReason b ON (a.barcode = b.barcode)
> regards|||h
temp table at a time will contain on 5000 records .
thnks|||sanjay
Why did you create non clustered index on the status column? It seems to be
useless because of low selectivity of the column . You could have 'approved'
,''not approved " ...what else?
but non clustered index would be more useful if your data will be at least
95% selective.
I'd suggest you to remove the index from status column and run the query.
"sanjay" <anonymous@.discussions.microsoft.com> wrote in message
news:740BBFD5-7611-45CF-B85E-7ECC5F4D22FC@.microsoft.com...
> hi
> temp table at a time will contain on 5000 records ..
> thnks|||Unless the status column is part of a covering index...
--
Ray Higdon MCSE, MCDBA, CCNA
--
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23flIAj4$DHA.684@.tk2msftngp13.phx.gbl...
> sanjay
> Why did you create non clustered index on the status column? It seems to
be
> useless because of low selectivity of the column . You could have
'approved'
> ,''not approved " ...what else?
> but non clustered index would be more useful if your data will be at least
> 95% selective.
> I'd suggest you to remove the index from status column and run the query.
>
> "sanjay" <anonymous@.discussions.microsoft.com> wrote in message
> news:740BBFD5-7611-45CF-B85E-7ECC5F4D22FC@.microsoft.com...
> > hi
> > temp table at a time will contain on 5000 records ..
> >
> > thnks
>

No comments:

Post a Comment