I use global temps only when I've got some sort of multi threaded process where I don't have a permanent table to support it. And usually I have a permanent table to support it.
SELECT DISTINCT p.ProductID FROM Production.Product AS p LEFT JOIN Production.TransactionHistory AS th ON th.ProductID = p.ProductID WHERE th.ProductId < 10;
select distinct p.productid from production.productid as p where exists (
select 1 from production.transactionhistory th where p.productid = th.productid and th.productid < 10)
@Zane we took a database offline last week after a month of weekly communication and keep getting angry emails saying "WHY IS THIS STILL OFFLINE!!!?? WHAT DO WE NEED TO GET IT ONLINE???!!!!"
@JNK Looks like it's the same order of operations, just with nested loops (left semi join) operator instead of nested loops (inner join). And yes, there is an index for both columns.
@JNK yeah that shouldn't require any downtime as far as i know
But it's an unusual scenario there, so my guess is the person telling you that hasn't done it before
One of the more annoying things about working there was that despite all the hardware they own, it was really difficult to get access to a lab environment for testing scenarios like that