dbTalk Databases Forums  

How to force subquery being the first executed

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss How to force subquery being the first executed in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
Aya the Vampire Slayer
 
Posts: n/a

Default Re: How to force subquery being the first executed - 08-27-2008 , 11:54 AM






sybrandb (AT) hccnet (DOT) nl wa:
Quote:
On Wed, 27 Aug 2008 08:33:23 -0700 (PDT), Barry Bulsara
bbulsara23 (AT) hotmail (DOT) com> wrote:

Most remaining subscribers
to this group would like a lot more professionalism and technical
input and a lot lot less ad hominem comment.

I assume by 'most' you mean basically 'I'?
While I realize that you are a 10-year veteran of this group (at least,
so you've said) and probably get tired of answering the same questions
over and over again, it's still no excuse to be rude to people when
telling them to go use google instead of wasting your time. Especially
if you want to increase readership. Everyone has to start somewhere
before becoming an expert with something as complex as Oracle (DB,
AppServer, whatever), and being encouraging rather than derogatory is
more likely to get people to stick around after they stop being annoying
n00bs.


Quote:
Because you are the only one complaining, and as Usenet doesn't have
'subscribers' as far as I am concerned the subscribers you mention are
virtual.
Most people just don't want to get involved in an obviously impending
flamewar over something theoretically off-topic by showing support for
someone who is willing to step forward and call another person out on
their rude behavior. So yeah, I agree with Barry. Sorry.

I've been subbed to these oracle groups for about a year now but up
until about a month or two ago have done nothing but immediately
'catchup' the groups without even reading. I'm not sure what got me
actually reading them recently, but it has been enlightening so far,
random bouts of crankiness aside.

--
"Care must be exorcised when handring Opiticar System as it is apts to
be sticked by dusts and hand-fat." --Japanese Translators

"Keep your fingers off the lens." --Elton Byington, English Translator


Reply With Quote
  #22  
Old   
Malcolm Dew-Jones
 
Posts: n/a

Default Re: How to force subquery being the first executed - 08-27-2008 , 12:26 PM






Peter Kallweit (p_kallweit (AT) arcor (DOT) de) wrote:
: Hi %,

: I've a question about 'leading' the optimizer. To make it not too
: simple, it should work from 9.2.0.4 up to 11.1.0.6.

: I'm selecting from a heavy view (many joins, big result set), using a
: subquery to restrict the result:
: select *
: from heavyView
: where keys in (select keys from simpleView);

: In most cases the query starts with complete execution of the heavyView
: and is then restricting the result using the subquery. This results in a
: very bad performance.

: However, from the application logic I know, that the subquery returns
: only a few rows.
: Therefore I want the query to start with the subquery, and then going
: with the result rows into the main view.
: Indexes to support accessing the main view in this way are available.

: How can I enforce this execution order?

No idea, but there are various ways to structure your query. I would try
them all to see what works best.

syntax not correct

with simple as
( select ...
)
select * from heavy where clause using simple

select heavy.*
from heavy,simple
where heavy.key=simple.key

select
( select c1 from heavy h where h.k = s.k) C1 ,
( select c2 from heavy h where h.k = s.k) C2 ,
...
from
simple s


probably others, it may or may not make a difference.



Reply With Quote
  #23  
Old   
Malcolm Dew-Jones
 
Posts: n/a

Default Re: How to force subquery being the first executed - 08-27-2008 , 12:26 PM



Peter Kallweit (p_kallweit (AT) arcor (DOT) de) wrote:
: Hi %,

: I've a question about 'leading' the optimizer. To make it not too
: simple, it should work from 9.2.0.4 up to 11.1.0.6.

: I'm selecting from a heavy view (many joins, big result set), using a
: subquery to restrict the result:
: select *
: from heavyView
: where keys in (select keys from simpleView);

: In most cases the query starts with complete execution of the heavyView
: and is then restricting the result using the subquery. This results in a
: very bad performance.

: However, from the application logic I know, that the subquery returns
: only a few rows.
: Therefore I want the query to start with the subquery, and then going
: with the result rows into the main view.
: Indexes to support accessing the main view in this way are available.

: How can I enforce this execution order?

No idea, but there are various ways to structure your query. I would try
them all to see what works best.

syntax not correct

with simple as
( select ...
)
select * from heavy where clause using simple

select heavy.*
from heavy,simple
where heavy.key=simple.key

select
( select c1 from heavy h where h.k = s.k) C1 ,
( select c2 from heavy h where h.k = s.k) C2 ,
...
from
simple s


probably others, it may or may not make a difference.



Reply With Quote
  #24  
Old   
Malcolm Dew-Jones
 
Posts: n/a

Default Re: How to force subquery being the first executed - 08-27-2008 , 12:26 PM



Peter Kallweit (p_kallweit (AT) arcor (DOT) de) wrote:
: Hi %,

: I've a question about 'leading' the optimizer. To make it not too
: simple, it should work from 9.2.0.4 up to 11.1.0.6.

: I'm selecting from a heavy view (many joins, big result set), using a
: subquery to restrict the result:
: select *
: from heavyView
: where keys in (select keys from simpleView);

: In most cases the query starts with complete execution of the heavyView
: and is then restricting the result using the subquery. This results in a
: very bad performance.

: However, from the application logic I know, that the subquery returns
: only a few rows.
: Therefore I want the query to start with the subquery, and then going
: with the result rows into the main view.
: Indexes to support accessing the main view in this way are available.

: How can I enforce this execution order?

No idea, but there are various ways to structure your query. I would try
them all to see what works best.

syntax not correct

with simple as
( select ...
)
select * from heavy where clause using simple

select heavy.*
from heavy,simple
where heavy.key=simple.key

select
( select c1 from heavy h where h.k = s.k) C1 ,
( select c2 from heavy h where h.k = s.k) C2 ,
...
from
simple s


probably others, it may or may not make a difference.



Reply With Quote
  #25  
Old   
Malcolm Dew-Jones
 
Posts: n/a

Default Re: How to force subquery being the first executed - 08-27-2008 , 12:26 PM



Peter Kallweit (p_kallweit (AT) arcor (DOT) de) wrote:
: Hi %,

: I've a question about 'leading' the optimizer. To make it not too
: simple, it should work from 9.2.0.4 up to 11.1.0.6.

: I'm selecting from a heavy view (many joins, big result set), using a
: subquery to restrict the result:
: select *
: from heavyView
: where keys in (select keys from simpleView);

: In most cases the query starts with complete execution of the heavyView
: and is then restricting the result using the subquery. This results in a
: very bad performance.

: However, from the application logic I know, that the subquery returns
: only a few rows.
: Therefore I want the query to start with the subquery, and then going
: with the result rows into the main view.
: Indexes to support accessing the main view in this way are available.

: How can I enforce this execution order?

No idea, but there are various ways to structure your query. I would try
them all to see what works best.

syntax not correct

with simple as
( select ...
)
select * from heavy where clause using simple

select heavy.*
from heavy,simple
where heavy.key=simple.key

select
( select c1 from heavy h where h.k = s.k) C1 ,
( select c2 from heavy h where h.k = s.k) C2 ,
...
from
simple s


probably others, it may or may not make a difference.



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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.