Re: Re: explain plan conundrum

2003-11-05 Thread Wolfgang Breitling
Histograms are only used to refine the selectivity of a predicate. This in turn determines the cardinality estimate and various costs such as index access cost and then of course join costs (NL, sort-merge, and hash) and join cardinality. This ultimately will drive the decision whether a partic

Re: Re: explain plan conundrum

2003-11-05 Thread Wolfgang Breitling
The join order of an access plan - in the absence of any leading or ordered hints - is determined strictly like everything else by the CBO: the join order with the lowest estimated cost wins. And the selectivity and cardinality estimates play a big role in determining the cardinality and thus c

Re: Re: explain plan conundrum

2003-11-05 Thread Mladen Gogala
> Date: 2003/11/05 Wed AM 11:49:26 EST > > To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> > > Subject: Re: Re: explain plan conundrum > > > > However, since it is a join predicate, the histogram data can not be used. > > The CBO uses the d

Re: Re: explain plan conundrum

2003-11-05 Thread ryan_oracle
are histograms only used to determine whether to use an index or join type, not join order? > > From: Wolfgang Breitling <[EMAIL PROTECTED]> > Date: 2003/11/05 Wed AM 11:49:26 EST > To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> > Subject: Re:

Re: Re: explain plan conundrum

2003-11-05 Thread ryan_oracle
and only 4 distinct values on the join column) oracle chooses the proper join 'order' > > From: Wolfgang Breitling <[EMAIL PROTECTED]> > Date: 2003/11/05 Wed AM 11:49:26 EST > To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> > Subject: Re: Re: exp

Re: Re: explain plan conundrum

2003-11-05 Thread Wolfgang Breitling
However, since it is a join predicate, the histogram data can not be used. The CBO uses the density values of the join column(s) to derive the join selectivity. The density value of a column changes (from 1/num_distinct) when you collect a histogram. If you create a frequency histogram (aka val

RE: Re: explain plan conundrum

2003-11-05 Thread Henry Poras
other table and that filters out enough > rows that that join should go first. The optimizer made a bad decision. > > how do i analyze why it made a bad join order decision? hints like this are > a stop gap fix. > > > > From: Yong Huang <[EMAIL PROTECTED]> > > Date: 2

Re: Re: explain plan conundrum

2003-11-04 Thread Ryan
optimizer made a bad decision. > > how do i analyze why it made a bad join order decision? hints like this are > a stop gap fix. > > > > From: Yong Huang <[EMAIL PROTECTED]> > > Date: 2003/11/04 Tue PM 02:09:30 EST > > To: Multiple recipients of list ORACLE-

RE: Re: explain plan conundrum

2003-11-04 Thread Henry Poras
t; To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> > Subject: Re: explain plan conundrum > > Hi, Ryan, > > Where's the 20 billion rows? There's 1 G rows and 20 G bytes. > > What are the values of NUM_ROWS in xxx_INDEXES for PK1 and xxx_TABLES f

Re: Re: explain plan conundrum

2003-11-04 Thread Wolfgang Breitling
Could you please post the entire sql and plan and statistics of the tables and indexes so that we can comment on it rather than letting us guess on selective bits of the entire problem. At 01:29 PM 11/4/2003, you wrote: everything is analyzed. For all indexes, for all indexed columns. I used an

Re: Re: explain plan conundrum

2003-11-04 Thread ryan_oracle
bad decision. how do i analyze why it made a bad join order decision? hints like this are a stop gap fix. > > From: Yong Huang <[EMAIL PROTECTED]> > Date: 2003/11/04 Tue PM 02:09:30 EST > To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> > Subject: Re: exp

Re: explain plan conundrum

2003-11-04 Thread Yong Huang
Hi, Ryan, Where's the 20 billion rows? There's 1 G rows and 20 G bytes. What are the values of NUM_ROWS in xxx_INDEXES for PK1 and xxx_TABLES for TABLE2? Did you analyze using ANALYZE command or DBMS_STATS? Yong Huang --- [EMAIL PROTECTED] wrote: > I cant sql trace it now. I hae run statspack.

Re: explain plan conundrum

2003-11-04 Thread ryan_oracle
i figured it out. I use the ordered hint. Its actually a 3 table join and I took that out for simplicity in my question. I drove off a more selective join. Got it to run in 1 minute. i almost never have to use ordered hint > > From: <[EMAIL PROTECTED]> > Date: 2003/11/04 Tue PM 01:34:26 EST >

Re: explain plan conundrum

2003-11-04 Thread Wolfgang Breitling
It's not 20 billion rows but 20 billion bytes. It's "only" 1 billion rows. The cartesion product of 5K rows and 366K rows is 1830M rows or 1.8G. If the join predicate is not very selective, .5 or .33 for example, that would yield an estimated join cardinality of 1G (after rounding). At 11:34 AM

Re: explain plan conundrum

2003-11-04 Thread ryan_oracle
some more info. I checked distinct values in those two tables. and there are 366,000 records in one table and 5,000 records in another however, the column that is joining to only has 4 distinct values. I added a bitmap index to the columns and its using it on the smaller table. Im willing to

RE: explain plan

2003-06-26 Thread Freeman Robert - IL
If you all are in 9i and you have not used dbms_xplan.display, give it a try... you will throw scripts like this one away forever! RF -Original Message- To: Multiple recipients of list ORACLE-L Sent: 6/26/2003 11:19 AM David - Here is the one I use. In my environment I just have one deve

RE: explain plan

2003-06-26 Thread Stephen Lee
Is this what you wanted? col OPERATION for a60 col OPTIONS for a40 col object_name for a32 select lpad(' ',2*(level-1)) || operation || ' ' || decode(id, 0, 'Cost = ' || position) "OPERATION", options, object_name from plan_table start with id = 0 connect by prior id = parent_id / > -Origina

RE: explain plan

2003-06-26 Thread DENNIS WILLIAMS
David - Here is the one I use. In my environment I just have one developer at a time using EXPLAIN, so I just have it truncate the table afterward. select lpad(' ',2*(level-1))||operation||' '||options||' '||object_name ||' '||decode(id,0,'Cost = '||position) "Query Plan" from plan_table

Re: Explain Plan vs Actual Execution Plan

2003-03-26 Thread Darrell Landrum
> > > The three-day seminar: > (see http://www.jlcomp.demon.co.uk/seminar.html ) > > UK_(Manchester)_May > USA_(CA, TX)_August > > > The Co-operative Oracle Users' FAQ > http://www.jlcomp.demon.co.uk/faq/ind_faq.html > > > - Original Message --

Re: Explain Plan vs Actual Execution Plan

2003-03-26 Thread Jonathan Lewis
ssage - > From: "Darrell Landrum" <[EMAIL PROTECTED]> > To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]> > Sent: 20 March 2003 21:28 > Subject: Re: Explain Plan vs Actual Execution Plan > > > > > This query was reading data fro

RE: Explain Plan vs Actual Execution Plan

2003-03-23 Thread Mark Richard
"Kevin Toepke" <[EMAIL PROTECTED] To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> racle.com> cc: Sent by:

RE: Explain Plan vs Actual Execution Plan

2003-03-21 Thread Darrell Landrum
Yes, that is specific for a partitioned table. Using dbms_stats.gather_table_stats, there is a parameter called granularity with which you can specify to gather stats for your table at different levels: DEFAULT: Gather global- and partition-level statistics. SUBPARTITION: Gather subpartition-leve

RE: Explain Plan vs Actual Execution Plan

2003-03-21 Thread Jacques Kilchoer
Title: RE: Explain Plan vs Actual Execution Plan I'm open to abuse if I'm wrong, but I think that the intended distinction was: let's assume table T with partitions P1 and P2 analyze table t compute statistics ; <--- global statistics analyze table t partition (p1)

RE: Explain Plan vs Actual Execution Plan

2003-03-21 Thread Kevin Toepke
Yes, local statistics are the partition specific statitics. Global stats are on the partitioned object as a whole. Global stats are vitally important when you are accessing more than one partition. If you are accessing > 1 partition and you do not have global stats, then the optimizer will use the

RE: Explain Plan vs Actual Execution Plan

2003-03-21 Thread Odland, Brad
Please exlain the difference between local and global statistics. Is this statisitics on a partition? Brad Odland -Original Message- Sent: Thursday, March 20, 2003 3:29 PM To: Multiple recipients of list ORACLE-L Brad, you're absolutely correct. Explain plan is what is intended, but

Re: Explain Plan vs Actual Execution Plan

2003-03-20 Thread Jonathan Lewis
The really cute thing about the need for global statistics to be reasonable - a few pages further on you'll find the comment that in 8i you can't generate global histograms ! (Fixed in 9i) Regards Jonathan Lewis http://www.jlcomp.demon.co.uk One-day tutorials: (see http://www.jlcomp.demon.co.

Re: Explain Plan vs Actual Execution Plan

2003-03-20 Thread Darrell Landrum
Brad, you're absolutely correct. Explain plan is what is intended, but isn't what always happens. It probably is most of the time, but not always. I recently had a circumstance in which a long running job (the explain plan of) was telling me it was reading from a big partitioned table and usi

RE: Explain Plan vs Actual Execution Plan

2003-03-20 Thread Cary Millsap
I think you can trust the STAT lines in a SQL trace file to give you accurate information about what execution plan *did* take place. The test I would suggest is to compare the information in these lines to what EXPLAIN PLAN shows you. You'll need to look at the raw trace data, though, because tkpr

Re: Explain Plan vs Actual Execution Plan

2003-03-20 Thread Stephane Faroult
"Odland, Brad" wrote: > > Hello, > > Heres a question to ponder. While tuning a SQL statment for a user I noticed > that the explain plan from SQL Analyze was not the same plan that was found > when I used OEM Top Sessions (9.2.0.1) upon executing to collect execution > stats. Database is on HP/

RE: explain plan parameter meanings

2003-01-03 Thread Stephane Faroult
>In the explain plan what is meant by "cost" , >"card" and "byte" ?=0D >How may they be interpreted practically ?=0D >Any Docs , Links on the Same ?=0D > =0D > =0D 'cost' like in 'cost based analyzer' - compound value which gives the CBO estimate of how much dreadful it will be to bring

Re: explain plan parameter meanings

2003-01-03 Thread Mogens Nørgaard
Cost is the optimizer cost. Card is cardinality. Byte is number of bytes processed in that particular step. Lots and lots of documentation on this. VIVEK_SHARMA wrote: Message In the explain plan what is meant by "cost" , "card"  and "byte"  ? How may they be interpret

RE: Explain plan of a table you do not own

2002-09-23 Thread MacGregor, Ian A.
if a database link is not involved you can use alter session set current_schema = ; After you explain it, be sure to reset the current_schema back to what it was. Ian MacGregor Stanford Linear Accelerator Center [EMAIL PROTECTED] -Original Message- Sent: Monday, September 23, 2002 1:09

Re: Explain plan of a table you do not own

2002-09-23 Thread Mohammed Shakir
How about trying "table_owner".table_name in your query where you specify the tablename in your from clause? Regards, --- Van der Sande Patrick <[EMAIL PROTECTED]> wrote: > Dear, > > As system I want to generate an explain plan of an end user query. > In this query a number of tables are def

Re: Explain plan of a table you do not own

2002-09-21 Thread Mark J. Bobak
ALTER SESSION SET CURRENT_SCHEMA = ; -Mark On Sat, 2002-09-21 at 15:33, Van der Sande Patrick wrote: > Dear, > > As system I want to generate an explain plan of an end user query. > In this query a number of tables are defined which do not have a public synonym. > > The explain plan ... statem

Re: Explain Plan Question

2002-08-12 Thread Mladen Gogala
No, it isn't correct. Explain plan gives you precisely what it should, and that is the access plan. Here is an excerpt from the documentation: The EXPLAIN PLAN statement displays e

RE: Explain Plan and SQL Text Length

2002-07-24 Thread MacGregor, Ian A.
As certain southern sportsmen often say, "My bad." It wasn't the explain statement but the program which builds them. Work done at 1:30 AM is always suspect. Ian MacGregor Stanford Linear Accelerator Center [EMAIL PROTECTED] -Original Message- Sent: Wednesday, July 24, 2002 10:09 A

Re: Explain Plan and SQL Text Length

2002-07-24 Thread Tim Gorman
Oracle Apps r10.7 and r11.0 had some SQL statements from PRO*C batch programs that are over 20K in length. Utterly astounding! Since VARCHAR2 variables can be up to 32767 in PL/SQL, I've written PL/SQL packages that used string variables of that length for automating EXPLAIN PLAN execution and s

RE: Explain Plan and SQL Text Length

2002-07-24 Thread Toepke, Kevin M
Ian: Any valid SQL statement can be explained. I've explained queries that were well over 4k -- even when you excluded the whitespace! Kevin -Original Message- Sent: Wednesday, July 24, 2002 11:50 AM To: Multiple recipients of list ORACLE-L What is the longest SQL statement that can b

Re: explain plan question

2002-06-06 Thread Joe Testa
Sore area, hmmm, sounds off topic to me. :) joe Gurelei wrote: >Peter, Charile: > >Sore area size is 5 times more in prod DB, shared pool >is larger in dev, db_block_buffers in dev is twice the >size in prod. I guess this answers my question. > >thanks > >Gene > > > > >--- Peter Gram <[EMAIL P

Re: explain plan question

2002-06-06 Thread Gurelei
Peter, Charile: Sore area size is 5 times more in prod DB, shared pool is larger in dev, db_block_buffers in dev is twice the size in prod. I guess this answers my question. thanks Gene --- Peter Gram <[EMAIL PROTECTED]> wrote: > Gurelei > > Are the parameter's the same ? > > sort* > hash

Re: explain plan question

2002-06-06 Thread Peter Gram
Gurelei Are the parameter's the same ? sort* hash* *pool* db* Gurelei wrote: >Hi. > >I have executed an explain plan on a dev and prod >databases. Both databases have the same data, use the >same version of ORacle (8.1.7.0) and the same OS (AIX >4.3.3). All the tables are analyzed. The plans h

RE: explain plan is changing ...

2001-09-14 Thread Nicoll, Iain (Calanais)
!! Please do not post Off Topic to this List !! Does estimate without samples size or percentage not just use 1024 as the sample size?. If you look at dba_tab_columns the samples size will be in there. If the table is not too big could you try it with compute statistics or estimate statistics wi

RE: explain plan is changing ...

2001-09-13 Thread g g
!! Please do not post Off Topic to this List !! Christopher: I don't have the histograms. Regarding the data, I actually think they are equally spread, but I will check. Is there any tool to do this, or is it just select count() from .. where ...? --- Christopher Spence <[EMAIL PROTECTED]> wro

RE: explain plan is changing ...

2001-09-13 Thread g g
!! Please do not post Off Topic to this List !! I have analyzed them today via: analyze table ... estimate statistics; analyze table ... estimate statistics for all indexed columns; No data were added/modified agter that --- "Nicoll, Iain (Calanais)" <[EMAIL PROTECTED]> wrote: > !! Please do

RE: explain plan is changing ...

2001-09-13 Thread Christopher Spence
!! Please do not post Off Topic to this List !! You probably have histograms, and very skewed data. "Do not criticize someone until you walked a mile in their shoes, that way when you criticize them, you are a mile a way and have their shoes." Christopher R. Spence Oracle DBA Phone: (978) 322-

RE: explain plan is changing ...

2001-09-13 Thread Nicoll, Iain (Calanais)
!! Please do not post Off Topic to this List !! Have they been analyzed recently? as if you were using histograms then if the last two months were added after your last analyze it would think they were fairly rare. Cheers Iain Nicoll -Original Message- Sent: 13 September 2001 19:11 To:

Re: Explain Plan different on TEST and PRODUCTION instance

2001-08-13 Thread Mohammad Rafiq
Just for your reading... MOHAMMAD RAFIQ Reply-To: [EMAIL PROTECTED] To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> Date: Fri, 03 Aug 2001 15:36:05 -0800 Brijesh, Even though OPTIMIZER_MODE=RULE, the CBO will be used in the presence of other features (e.g. partitioning, degree o

RE: Explain Plan different on TEST and PRODUCTION instance

2001-08-06 Thread Gupta, Brijesh
Title: RE: Explain Plan different on TEST and PRODUCTION instance Thanks Anita,     It was the degree of parallelism that was creating the problem. I was just checking the degree column of the dba_indexes to set the parallelism , which was 1 but the INSTANCES column was set to DEFAULT

Re: Explain Plan different on TEST and PRODUCTION instance

2001-08-04 Thread Sukumar Kurup
Brijesh, Another thing to check is if the tables involved have been analyzed on prod database. Sukumar Kurup __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- Please see the

Re: Explain Plan different on TEST and PRODUCTION instance

2001-08-04 Thread Sukumar Kurup
--- "A. Bardeen" <[EMAIL PROTECTED]> wrote: > Brijesh, > > Even though OPTIMIZER_MODE=RULE, the CBO will be > used > in the presence of other features (e.g. > partitioning, > degree of parallelism, etc...). > > In this case TEST is getting a better plan because > the > CBO is being used. You c

Re: explain plan question

2001-07-11 Thread paquette stephane
The access plan obtained with bind variables is a guess plan because the optimiser lacks information. The plan obtained with real data is a definitive plan because the optimiser knows everything he needs in order to make a decision. It's nice to used bind variables to save on parsing but real

RE: explain plan question

2001-07-11 Thread Christopher Spence
Depends, if your using bind variables in production, then you can expect to have a very static choice of explain plans. Although bind variables are great for promoting more efficient use of the shared pool, you do hinder the optimizer's ability to use selectivity and histograms to detirmine if an

RE: explain plan question

2001-07-11 Thread Toepke, Kevin M
Gene: which everone is used in production. If the statements are dynamically built with "variable" hard-coded values then you have a couple options. 1) Tune the query for the worst case 2) Tune the query for bind-variables and set "cursor_sharing = force" in your init.ora HTH Kevin --

Re: explain plan

2001-06-15 Thread Tommy Wareing
On Fri, Jun 15, 2001 at 02:05:44AM -0800, Raymond Lee Meng Hong wrote: > Hei Guru. > > I have a query which involve to some across table , here is my explain plan > . As a developer is we alway choice a best way to select table , I do join > those field related together ,but why it still perform