• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

SQL Help please

Don't need to. 9 times out of 10 a join on two columns with appropriate indexes will generate a better execution plan than using IN, which ends up using a hash/match algorithm.

Possibly. depends if the indexes are used or not. Exists might work better. Who knows? Only can tell when you see the execution plan. For inner joins I agree the indexes will speed things along, I'm not certain a left outer join where the right side is filtered to be empty will be faster than a Exists. Then, if he's using mySQL the Left join AFAIK does something unlike a left outer join.
 
Possibly. depends if the indexes are used or not. Exists might work better. Who knows? Only can tell when you see the execution plan. For inner joins I agree the indexes will speed things along, I'm not certain a left outer join where the right side is filtered to be empty will be faster than a Exists. Then, if he's using mySQL the Left join AFAIK does something unlike a left outer join.

Nice try - but I mentioned Execution Plan first. There can be only one, etc.
 
chaps,
Performance isn't a problem unless it's a problem.


anyway, I quite fancy
SELECT customerid FROM customer
MINUS
SELECT customerid FROM order;
 
chaps,
Performance isn't a problem unless it's a problem.


anyway, I quite fancy
SELECT customerid FROM customer
MINUS
SELECT customerid FROM order;

Performance: ... er, and?

That SQL: Hmmm... 2 potentially big sets of data operated on, battering the DB nicely. Where do you work? I could make a killing, even if I just stopped the lights dimming every time you run your lovely SQL!
 
potentially big

potentially big

you're inventing your own nonfunctional requirements there.

When you go down the shops, do you always drive a 54-seater coach because you could "potentially" meet 53 mates wanting a lift along the way?
 
you're inventing your own nonfunctional requirements there.

When you go down the shops, do you always drive a 54-seater coach because you could "potentially" meet 53 mates wanting a lift along the way?

Size of the data sets was not mentioned, so fair to assume could be large. I win... again.
 

Advertisers

Back
Top