Link to home
Start Free TrialLog in
Avatar of dbaSQL
dbaSQLFlag for United States of America

asked on

just a real quick question

hi there.  this isn't critical at all, i'm actually just looking for other opinions as to how the following could be accomplished most appropriately.  i've got to run the code below on demand in production via procedure.  there are upwards of 88M records in prod, growing daily, and the archival does not run on this particular repository.  so, it's only getting bigger.  (at least for now, as the db design is not going to change)   So, my concern is simply design.  See the WITH (NOLOCK) and MAXDOP, I'm just trying to ensure I am not hindering other active connections when this thing is run.  you know...i don't want to invite any concurrency problems.  Any thoughts?

SELECT Symbol,
'Quantity' = CASE
    WHEN BS = 'S' THEN quantity * (-1)
    WHEN BS = 'B' THEN quantity END, [Time]
FROM ........ WITH (NOLOCK)
WHERE [Time] BETWEEN @start AND @stop
AND EndPoint IN (...........great big IN list.............)
ORDER BY [Time]
OPTION (MAXDOP 1)
SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dbaSQL

ASKER

anees, are you referring to MAXDOP?
kevin/ved, yes there is an idx on time.  and the tmp table, do you feel there's a sufficient gain there?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
> anees, are you referring to MAXDOP?

I  am referring to NOLOCK option,
Yes....a join will typically outperform an IN list
Avatar of dbaSQL

ASKER

excellent.  i appreciate all of your feedback.  i will split the points