home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.databases:6349 comp.databases.theory:402 comp.databases.oracle:1388
- Path: sparky!uunet!stanford.edu!rutgers!uwvax!hellers
- From: hellers@wisc.edu (Joseph Hellerstein)
- Newsgroups: comp.databases,comp.databases.theory,comp.databases.oracle
- Subject: Re: Is this a bug or a limitation of the SQL language
- Message-ID: <HELLERS.92Aug26152713@cleo.wisc.edu>
- Date: 26 Aug 92 21:27:13 GMT
- References: <1992Aug23.074048.16681@prism.poly.edu> <1992Aug24.100941.24827@dk.oracle.com>
- <JOEY.92Aug24091348@elysium.berkeley.edu>
- <BtJKIG.2K5@watdragon.uwaterloo.ca>
- <HELLERS.92Aug25181305@cleo.wisc.edu>
- <BtLuFp.Kp6@watdragon.uwaterloo.ca>
- Sender: news@cs.wisc.edu (The News)
- Organization: UW-Madison
- Lines: 25
- In-Reply-To: gnpaulle@maytag.uwaterloo.ca's message of Wed, 26 Aug 1992 19:07:00 GMT
-
- In article <BtLuFp.Kp6@watdragon.uwaterloo.ca> gnpaulle@maytag.uwaterloo.ca (Glenn Paulley) writes:
-
- > > In article <BtJKIG.2K5@watdragon.uwaterloo.ca> gnpaulle@maytag.uwaterloo.ca (Glenn Paulley) writes:
- > > > [I wrote:]
- > > > |select * from emp
- > > > |where salary between
- > > > |(select salary from emp where ename = 'Larry')
- > > > |and
- > > > |(select salary from emp where ename = 'John')
- > >
- > > > You want to avoid subqueries whenever possible. To get what you need,
- > > > try the following:
- > >
- > However, the scalar subqueries above are not correlated, so
- > I still fail to see how join processing could perform better than (basically)
- > a single scan- nested loops aren't required. Again, I'm assuming that
- > ename is indexed, or in some way it's possible to determine Larry
- > and John's salary quickly.
-
- You're right -- in this example, since the subqueries are scalar and
- not correlated, the expression above is as good as any other. My
- error. It's still a healthy knee-jerk reaction to convert subqueries
- to joins, but in this case it doesn't help.
-
- Joe Hellerstein
-