Re: Higher Consistent Gets...

2001-09-15 Thread Jonathan Lewis


You don't quote a version of Oracle - which makes
a difference to the ROWS column on the execution
path.

However, I think you are seeing the extra I/O because
Oracle is driving off the main table, then executing the
subquery for each row returned - thus executing your
5 logical I/O many times.  Ideally you would probably
like Oracle to use the subquery to drive the main query.

You may be able to do this by converting the subquery
into an inline view, and joining it (perhaps with an ORDERED
hint) to the main query:

select /*+ ordered  */
...
from
(
select location_code
from gn_location
connect by prior location_code=parent_code
start with location_code='3142'
)v
fr_search_query pd
where
pd.location_code = v.location_code
and
etc.




Jonathan Lewis
http://www.jlcomp.demon.co.uk

Host to The Co-Operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html

Author of:
Practical Oracle 8i: Building Efficient Databases

Screen saver or Life saver: http://www.ud.com
Use spare CPU to assist in cancer research.

-Original Message-
To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
Date: 14 September 2001 18:10


|!! Please do not post Off Topic to this List !!
|
|Hi
|
|I am having problem with a query. This query fetches rows from a
table which
|has 15 million rows.
|
|The problem is, when I execute this query with subquery, the
consistent gets
|are 4700. Where us without the subquery the consistent gets are just
400. If
|I execute the subquery alone, the consistent gets are just 5.
|
|
|Here is the main query with subquery results in cons.gets of 4700:
|
|
|select pd.holiday_id holidayID,   pd.package_number l_package_number,
|   min(pd.tfr_price) l_tpr_price
|  from fr_search_query pd
| where pd.departure_date between TO_DATE('06/10/2001','dd/mm/')
| and TO_DATE('13/10/2001','dd/mm/')
|   and pd.location_code in (select location_code
|  from gn_location
|connect by prior
location_code=parent_code
|  start with location_code='3142')
|   and ROWNUM < 301
| group by pd.holiday_id ,   pd.package_number
| order by pd.location_name,   pd.location_code,   pd.accom_unit_name,
|  pd.accom_unit_code,   pd.departure_date,
min(pd.adult_price)
|


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jonathan Lewis
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Higher Consistent Gets...

2001-09-14 Thread Khedr, Waleed

!! Please do not post Off Topic to this List !!

Try this and let's know how it works:

select --+ ordered use_hash(vw1)
   pd.holiday_id holidayID,   pd.package_number l_package_number,
   min(pd.tfr_price) l_tpr_price
  from fr_search_query pd , 
   (select --+ no_merge 
   location_code
 from gn_location
  connect by prior location_code=parent_code
  start with location_code='3142') vw1
 where pd.departure_date between TO_DATE('06/10/2001','dd/mm/')
 and TO_DATE('13/10/2001','dd/mm/')
   and pd.location_code = vw1.location_code 
   and ROWNUM < 301
 group by pd.holiday_id ,   pd.package_number
 order by pd.location_name,   pd.location_code,   pd.accom_unit_name,
  pd.accom_unit_code,   pd.departure_date,   min(pd.adult_price)

Regards,

Waleed

-Original Message-
Sent: Friday, September 14, 2001 8:10 PM
To: Multiple recipients of list ORACLE-L


!! Please do not post Off Topic to this List !!


Raj,

Which query is fastest?  You don't have any timing information.

Make sure that timed_statistics is on in the database:

alter system set timed_statistics = true;

Run your query with trace on:
   alter session set sql_trace = true;

Then run the resulting trace files through tkprof.

You'll have much more information to work with.

Jared




 

Raj Gopalan


ons.co.uk>   cc:

Sent by: Subject: Higher
Consistent Gets... 
[EMAIL PROTECTED]

 

 

09/14/01 09:55 AM

Please respond to

ORACLE-L

 

 





!! Please do not post Off Topic to this List !!

Hi

I am having problem with a query. This query fetches rows from a table
which
has 15 million rows.

The problem is, when I execute this query with subquery, the consistent
gets
are 4700. Where us without the subquery the consistent gets are just 400.
If
I execute the subquery alone, the consistent gets are just 5.


Here is the main query with subquery results in cons.gets of 4700:


select pd.holiday_id holidayID,   pd.package_number l_package_number,
   min(pd.tfr_price) l_tpr_price
  from fr_search_query pd
 where pd.departure_date between TO_DATE('06/10/2001','dd/mm/')
 and TO_DATE('13/10/2001','dd/mm/')
   and pd.location_code in (select location_code
  from gn_location
connect by prior location_code=parent_code
  start with location_code='3142')
   and ROWNUM < 301
 group by pd.holiday_id ,   pd.package_number
 order by pd.location_name,   pd.location_code,   pd.accom_unit_name,
  pd.accom_unit_code,   pd.departure_date,   min(pd.adult_price)

Trace results

Rows Execution Plan
---  ---
  0  SELECT STATEMENT   GOAL: CHOOSE
 96   SORT (ORDER BY)
 96SORT (GROUP BY)
 96 COUNT (STOPKEY)
 96  NESTED LOOPS
   5137   INLIST ITERATOR
   5138TABLE ACCESS   GOAL: ANALYZED (BY INDEX ROWID) OF
   'FR_SEARCH_QUERY'
   8566 INDEX   GOAL: ANALYZED (RANGE SCAN) OF
'FR_SEARCH_QUERY_IND_1' (NON-UNIQUE)
 96   VIEW
   5136SORT (UNIQUE)
  1 CONNECT BY
  2  INDEX   GOAL: ANALYZED (FAST FULL SCAN) OF
 'PK_GN_LOCATION' (UNIQUE)
  1  TABLE ACCESS (BY USER ROWID) OF 'GN_LOCATION'
  1  TABLE ACCESS (FULL) OF 'GN_LOCATION'


Running just the subquery results in cons.gets of just 5.


  select location_code
from gn_location
 connect by prior location_code=parent_code
   start with location_code='3142'


Rows Execution Plan
---  ---
  0  SELECT STATEMENT   GOAL: CHOOSE
  1   CONNECT BY
  2INDEX   GOAL: ANALYZED (UNIQUE SCAN) OF 'PK_GN_LOCATION'
   (UNIQUE)
  1TABLE ACCESS (BY USER ROWID) OF 'GN_LOCATION'
  1TABLE ACCESS (RANGE SCAN) OF 'GN_PARENT_LOCATION_CODE'
(NON-UNIQUE)


Both the tables, indexes are analyzed. The optimizer mode is choose.

How do I tune this or Am I missing something obivious??

Thanks

Raj
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Raj Gopalan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also se

Re: Higher Consistent Gets...

2001-09-14 Thread Jared . Still

!! Please do not post Off Topic to this List !!


Raj,

Which query is fastest?  You don't have any timing information.

Make sure that timed_statistics is on in the database:

alter system set timed_statistics = true;

Run your query with trace on:
   alter session set sql_trace = true;

Then run the resulting trace files through tkprof.

You'll have much more information to work with.

Jared




   
 
Raj Gopalan
 

ons.co.uk>   cc:   
 
Sent by: Subject: Higher Consistent 
Gets... 
[EMAIL PROTECTED]   
 
   
 
   
 
09/14/01 09:55 AM  
 
Please respond to  
 
ORACLE-L   
 
   
 
   
 




!! Please do not post Off Topic to this List !!

Hi

I am having problem with a query. This query fetches rows from a table
which
has 15 million rows.

The problem is, when I execute this query with subquery, the consistent
gets
are 4700. Where us without the subquery the consistent gets are just 400.
If
I execute the subquery alone, the consistent gets are just 5.


Here is the main query with subquery results in cons.gets of 4700:


select pd.holiday_id holidayID,   pd.package_number l_package_number,
   min(pd.tfr_price) l_tpr_price
  from fr_search_query pd
 where pd.departure_date between TO_DATE('06/10/2001','dd/mm/')
 and TO_DATE('13/10/2001','dd/mm/')
   and pd.location_code in (select location_code
  from gn_location
connect by prior location_code=parent_code
  start with location_code='3142')
   and ROWNUM < 301
 group by pd.holiday_id ,   pd.package_number
 order by pd.location_name,   pd.location_code,   pd.accom_unit_name,
  pd.accom_unit_code,   pd.departure_date,   min(pd.adult_price)

Trace results

Rows Execution Plan
---  ---
  0  SELECT STATEMENT   GOAL: CHOOSE
 96   SORT (ORDER BY)
 96SORT (GROUP BY)
 96 COUNT (STOPKEY)
 96  NESTED LOOPS
   5137   INLIST ITERATOR
   5138TABLE ACCESS   GOAL: ANALYZED (BY INDEX ROWID) OF
   'FR_SEARCH_QUERY'
   8566 INDEX   GOAL: ANALYZED (RANGE SCAN) OF
'FR_SEARCH_QUERY_IND_1' (NON-UNIQUE)
 96   VIEW
   5136SORT (UNIQUE)
  1 CONNECT BY
  2  INDEX   GOAL: ANALYZED (FAST FULL SCAN) OF
 'PK_GN_LOCATION' (UNIQUE)
  1  TABLE ACCESS (BY USER ROWID) OF 'GN_LOCATION'
  1  TABLE ACCESS (FULL) OF 'GN_LOCATION'


Running just the subquery results in cons.gets of just 5.


  select location_code
from gn_location
 connect by prior location_code=parent_code
   start with location_code='3142'


Rows Execution Plan
---  ---
  0  SELECT STATEMENT   GOAL: CHOOSE
  1   CONNECT BY
  2INDEX   GOAL: ANALYZED (UNIQUE SCAN) OF 'PK_GN_LOCATION'
   (UNIQUE)
  1TABLE ACCESS (BY USER ROWID) OF 'GN_LOCATION'
  1TABLE ACCESS (RANGE SCAN) OF 'GN_PARENT_LOCATION_CODE'
(NON-UNIQUE)


Both the tables, indexes are analyzed. The optimizer mode is choose.

How do I tune this or Am I missing something obivious??

Thanks

Raj
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Raj Gopalan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECT