dbaSQL
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)
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> anees, are you referring to MAXDOP?
I am referring to NOLOCK option,
I am referring to NOLOCK option,
Yes....a join will typically outperform an IN list
ASKER
excellent. i appreciate all of your feedback. i will split the points
ASKER
kevin/ved, yes there is an idx on time. and the tmp table, do you feel there's a sufficient gain there?