Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Rewrite subselect with using a join

by dbwiz (Curate)
on Jun 02, 2005 at 07:53 UTC ( #462799=note: print w/replies, xml ) Need Help??


in reply to Rewrite subselect with using a join

You were using the wrong join.

Your snippet is moving computation from a database server to a client application, and it's doing that whitout any particular need.

The canonical way of transforming your query should go through a table JOIN. However, since you are subquerying the same table, your nested query is nothing more than this:

select object_id from mw_export_record where table_object != 'advertisers'; -- <-- operator change

The inner part of your query is selecting all the IDs containing 'advertisers', while the outer part is saying "don't take any record from this list."

Not only you are computing in the client what should be done in the server, but you are also telling the server to do something unnecessarily complex and heavy that it should not have been doing in the first place.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://462799]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2020-10-20 15:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (210 votes). Check out past polls.

    Notices?