Contractor UK Bulletin Board  PayStream

Go Back   Contractor UK Bulletin Board > Contractor UK Forums > Technical
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 23rd August 2007, 10:16   #11
DimPrawn
Godlike
 
DimPrawn's Avatar
 
Join Date: Jul 2005
Posts: 10,101
Default

Quote:
Originally Posted by richard-af View Post
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.
DimPrawn is offline   Reply With Quote
Old 23rd August 2007, 10:36   #12
scotspine
Moderator
 
Join Date: Jul 2005
Posts: 523
Default

Quote:
Originally Posted by DimPrawn View Post
SP, if anyone else disagrees with me, can you please ban them?


sure thing dp. us amateurs need to stick together.
scotspine is offline   Reply With Quote
Old 23rd August 2007, 10:44   #13
lilelvis2000
Contractor Among Contractors
 
lilelvis2000's Avatar
 
Join Date: Jul 2005
Location: the centre of the world - according to Jack Straw
Posts: 1,599
Default

Quote:
Originally Posted by DimPrawn View Post
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.
lilelvis2000 is offline   Reply With Quote
Old 23rd August 2007, 13:26   #14
richard-af
Fingers like lightning
 
richard-af's Avatar
 
Join Date: Jul 2007
Location: Monaco-on-Thames
Posts: 956
Default

Quote:
Originally Posted by lilelvis2000 View Post
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.
richard-af is offline   Reply With Quote
Old 23rd August 2007, 13:35   #15
thunderlizard
Super poster
 
Join Date: Jul 2005
Posts: 2,187
Default

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.
thunderlizard is offline   Reply With Quote
Old 23rd August 2007, 13:42   #16
King Cnvt
Banned
 
King Cnvt's Avatar
 
Join Date: May 2007
Posts: 805
Default

SQL Server 2005 has an EXCEPT clause which does the same as MINUS.
King Cnvt is offline   Reply With Quote
Old 23rd August 2007, 13:42   #17
richard-af
Fingers like lightning
 
richard-af's Avatar
 
Join Date: Jul 2007
Location: Monaco-on-Thames
Posts: 956
Default

Quote:
Originally Posted by thunderlizard View Post
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!
richard-af is offline   Reply With Quote
Old 23rd August 2007, 14:10   #18
thunderlizard
Super poster
 
Join Date: Jul 2005
Posts: 2,187
Default 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.
thunderlizard is offline   Reply With Quote
Old 23rd August 2007, 14:20   #19
richard-af
Fingers like lightning
 
richard-af's Avatar
 
Join Date: Jul 2007
Location: Monaco-on-Thames
Posts: 956
Default

Quote:
Originally Posted by thunderlizard View Post
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.
richard-af is offline   Reply With Quote
Old 23rd August 2007, 14:28   #20
King Cnvt
Banned
 
King Cnvt's Avatar
 
Join Date: May 2007
Posts: 805
Default

Couldn't you just ring up all the customers and ask them if they have any orders? FFS, kids of today....
King Cnvt is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT. The time now is 22:29.


Advertisers
PayStream

CUK Navigation

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

Fast Company Formation
Same day online company formation £75 + VAT

Form your Ltd Co Here

Contractor Services


 
Content Relevant URLs by vBSEO 2.4.0 © 2005, Crawlability, Inc.