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)
LVL 18
dbaSQLAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aneesh RetnakaranDatabase AdministratorCommented:
When this option is in effect, it is possible to read an uncommitted transaction or a set of pages that are rolled back in the middle of a read. Dirty reads are possible.
Kevin HillSr. SQL Server DBACommented:
maybe you create a temp table with your "great big IN list" as its rows, and join instead of doing IN?

Index on TIME?

Just some random thoughts

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ved Prakash AgrawalDatabase Consultant/Performance ArchitectCommented:
Hi you can place all in values into temp variable table and then used join to get same result as you can get in IN join .
In is slow when data is more so always tried to avoid that...
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

dbaSQLAuthor Commented:
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?
LowfatspreadCommented:
also consider
Select symbol,
quantity * x as quantity,[time]
from ...
 Inner Join (select 'B' as BSType, 1 as x union Select 'S', -1) as Qmod
    on Qmod.BSType = BS
 Inner Join ( endpoint table ) as Ept
   on Ept.Endpt = Endpoint
where [time] between @start and @stop

order by [Time]


 Have a covering index of
  Endpoint,[Time],symbol,BS,Quantity on the table..


Aneesh RetnakaranDatabase AdministratorCommented:
> anees, are you referring to MAXDOP?

I  am referring to NOLOCK option,
Kevin HillSr. SQL Server DBACommented:
Yes....a join will typically outperform an IN list
dbaSQLAuthor Commented:
excellent.  i appreciate all of your feedback.  i will split the points
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.