 |
|
23rd August 2007, 10:16
|
#11
|
|
Godlike
Join Date: Jul 2005
Posts: 10,101
|
Quote:
Originally Posted by richard-af
9 times out of 10? Unnecessary table scans??!!!
I weep for you both. Amateurs.
|
If you say so. You's the daddy.
__________________
By the time you finish reading this sentence, the national debt will have risen by another £1,500 - which you or your children will have to repay.
Just so you know.
|
|
|
23rd August 2007, 10:36
|
#12
|
|
Moderator
Join Date: Jul 2005
Posts: 523
|
Quote:
Originally Posted by DimPrawn
SP, if anyone else disagrees with me, can you please ban them?

|
sure thing dp. us amateurs need to stick together.
|
|
|
23rd August 2007, 10:44
|
#13
|
|
Contractor Among Contractors
Join Date: Jul 2005
Location: the centre of the world - according to Jack Straw
Posts: 1,599
|
Quote:
Originally Posted by DimPrawn
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.
|
|
|
23rd August 2007, 13:26
|
#14
|
|
Fingers like lightning
Join Date: Jul 2007
Location: Monaco-on-Thames
Posts: 956
|
Quote:
Originally Posted by lilelvis2000
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.
|
|
|
23rd August 2007, 13:35
|
#15
|
|
Super poster
Join Date: Jul 2005
Posts: 2,187
|
chaps,
Performance isn't a problem unless it's a problem.
anyway, I quite fancy
SELECT customerid FROM customer
MINUS
SELECT customerid FROM order;
__________________
If men were as much men as lizards are lizards
they'd be worth looking at.
|
|
|
23rd August 2007, 13:42
|
#16
|
|
Banned
Join Date: May 2007
Posts: 805
|
SQL Server 2005 has an EXCEPT clause which does the same as MINUS.
|
|
|
23rd August 2007, 13:42
|
#17
|
|
Fingers like lightning
Join Date: Jul 2007
Location: Monaco-on-Thames
Posts: 956
|
Quote:
Originally Posted by thunderlizard
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!
|
|
|
23rd August 2007, 14:10
|
#18
|
|
Super poster
Join Date: Jul 2005
Posts: 2,187
|
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?
__________________
If men were as much men as lizards are lizards
they'd be worth looking at.
|
|
|
23rd August 2007, 14:20
|
#19
|
|
Fingers like lightning
Join Date: Jul 2007
Location: Monaco-on-Thames
Posts: 956
|
Quote:
Originally Posted by thunderlizard
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.
|
|
|
23rd August 2007, 14:28
|
#20
|
|
Banned
Join Date: May 2007
Posts: 805
|
Couldn't you just ring up all the customers and ask them if they have any orders? FFS, kids of today....
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 22:29.
|  |
| Advertisers |
|
| Contractor Alliance |
Formed a new Ltd Co?
20% off business insurance
£10 off Bauer & Cottrell contract reviews
Find co-workers & client introductions
Increase your value to clients here
|
|