Tuesday, March 20, 2012

A better way? Short query

Code Snippet

UPDATE mr

SET [Test Name] = ic.[New Test Name],

Mnemonic = ic.[New Mnemonic]

FROM MRSTATS mr

INNER JOIN IdentityChanges ic

ON mr.Mnemonic = ic.Mnemonic

AND mr.[Test Name] = ic.[Test Name]

AND mr.Bill_Item_ID = ic.Bill_Item_ID

IdentityChanges has approximately 25 entries, MRSTATS has about 1.5 million

Hi,

why do you want a better way? If it's too slow, have you set an index like this:

Code Snippet

CREATE INDEX IX_IC_TO_MR

ON MRSTATS (Mnemonic, [Test Name], Bill_Item_ID)

Try it and and run the query again.

--

Regards,

Daniel Kuppitz

|||Sorry for the small amount of information, the query in my origional post takes upwards of 10 minutes. When I create this index do I need to specify how the columns map to eachother or does the statement assume that it means MR.Mnemonic maps to IC.Mnemonic? I do believe this is what i'm looking for. Will this create index statement work without modification because the query is still taking a really long time? Do I need to change the origional query at all? Thanks a lot for your help.|||I got it working. Thanks a lot.

No comments:

Post a Comment