Return-Path: <root@fatcity.cts.com>
Received: from newsfeed.cts.com (newsfeed.cts.com [209.68.248.164])
 by naude.co.za (8.11.2/8.11.2) with SMTP id g78Fsm726108
 for <oracle-l@naude.co.za>; Thu, 8 Aug 2002 11:54:48 -0400
Received: from fatcity.UUCP (uucp@localhost)
 by newsfeed.cts.com (8.9.3/8.9.3) with UUCP id IAA17249;
 Thu, 8 Aug 2002 08:54:45 -0700 (PDT)
Received: by fatcity.com (26-Feb-2001/v1.0g-b71/bab) via UUCP id 004AF275; Thu, 08 Aug 2002 08:18:38 -0800
Message-ID: <F001.004AF275.20020808081838@fatcity.com>
Date: Thu, 08 Aug 2002 08:18:38 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
X-Comment: Oracle RDBMS Community Forum
X-Sender: "Gogala, Mladen" <MGogala@oxhp.com>
Sender: root@fatcity.com
Reply-To: ORACLE-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
From: "Gogala, Mladen" <MGogala@oxhp.com>
Subject: RE: SOME SOLUTIONS!
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0g, build 71; ListGuru (c) 1996-2001 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-Type: multipart/alternative;	boundary="----_=_NextPart_001_01C23EEE.700305A0"
------_=_NextPart_001_01C23EEE.700305A0
Content-Type: text/plain

Star schema will really, really help if you have bitmap indexes on your fact
and details tables.
 

Mladen Gogala 
Oracle DBA 
Phone: (203) 459-6855 
Email:  mgogala@oxhp.com 

-----Original Message-----
Sent: Thursday, August 08, 2002 11:53 AM
To: Multiple recipients of list ORACLE-L



Guys, 

Any ideas why sum - with same exec. plan and not going to disk is 5 sec.
response versus subsecond and anyway to get around this w/o building a
preaggregated data set since there are so many permutations possible????
Will I have to redesign to use STAR SCHEMA and will that really help!!!

-----Original Message----- 
Sent: Thursday, August 08, 2002 10:40 AM 
To: 'ORACLE-L@fatcity.com' 


Okay, 

Just going from #1 query to #2 query went from subsecond response to 6 secs.
Not to mention for each sum it gets progressively worse!!!.  The explain
plan is exactly the same and I ran the sort query below and no rows
returned.

rem truncate table plan_table; 
set timing on; 
rem explain plan set statement_id='RON' for 
select 
/*+ INDEX(mv_birthstat,ndx_mvyr) */ 
 brth_mthr_res_newco_code  County,count(*), 
-- sum(cert_chld_brth_year) Num1 
 --sum(decode(greatest(cert_chld_brth_year,1996),
least(cert_chld_brth_year,1998 
), 1, 0)) / 3 Num2, 
 --sum(decode(greatest(cert_chld_brth_year,1997),
least(cert_chld_brth_year,1999 
), 1, 0)) / 3 Num3 
from mv_birthstat 
where cert_chld_brth_year between '1995' and '1999' 
and brth_mthr_res_state_code='10' 
and brth_mthr_age between 15 and 41 
group by brth_mthr_res_newco_code; 

/*+ INDEX(mv_birthstat,ndx_mvyr) */ 
 brth_mthr_res_newco_code  County, 
 sum(cert_chld_brth_year) Num1 
 --sum(decode(greatest(cert_chld_brth_year,1996),
least(cert_chld_brth_year,1998 
), 1, 0)) / 3 Num2, 
 --sum(decode(greatest(cert_chld_brth_year,1997),
least(cert_chld_brth_year,1999 
), 1, 0)) / 3 Num3 
from mv_birthstat 
where cert_chld_brth_year between '1995' and '1999' 
and brth_mthr_res_state_code='10' 
and brth_mthr_age between 15 and 41 
group by brth_mthr_res_newco_code; 



WHY WHY WHY WHY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
-----Original Message----- 
<mailto:jack_silvey@yahoo.com> ] 
Sent: Wednesday, August 07, 2002 11:37 PM 
To: Multiple recipients of list ORACLE-L 


Paula, 

Sorry to join this thread late, if I am rehashing just 
igonre. 

I notice that your 'numbers' are surrounded by quotes, 
which will implicitly disable the index on those 
columns, perhaps the cause of the index hint. Are 
those columns text or numbers? If numbers, take out 
the quotes (and perhaps the hint) and rerun query. 

Also, your aggregate functions will cause sorting - 
are you sorting to disk? See the query at the end of 
this to find out. If so, perhaps a larger 
sort_area_size and sort_area_retained_size might be in 
order. 

Again, ignore if redundant. 

Run this to look at sorting: 

select t1.tablespace 
, extents 
, sum( t1.blocks * to_number( t3.value ) ) / 1024 / 
1024 mb_used 
, sum( t1.extents ) tot_extents 
, t2.username 
, t2.osuser 
, t2.SID ||','|| t2.serial# SID_PID 
, t4.spid 
, t5.sql_text 
, t1.segtype 
from 
v$sort_usage t1 
,v$session t2 
,v$parameter t3 
,v$process t4 
,v$sqlarea t5 
where t1.SESSION_ADDR = t2.SADDR 
and t3.name = 'db_block_size' 
and (t2.PROCESS=t4.SPID or t2.paddr = t4.addr) 
and t2.sql_address=t5.address 
and t2.status = 'ACTIVE' 
group by 
t1.tablespace 
, t2.username 
, t2.osuser 
, t2.machine 
, t2.schemaname 
, t2.program 
, t2.SID ||','|| t2.serial# 
, t4.spid 
, t5.sql_text 
, t1.segtype 
, segfile# 
, extents 
/ 


hth, 

Jack 

--- Paula_Stankus@doh.state.fl.us wrote: 
> Guys, 
> 
> By changing objects to noparallel, creating 
> bitmapped index containing all 
> columns that was local and prefixed.  Moving to 
> 8.1.7.4 I was able to 
> improve performance from minutes to many seconds to 
> seconds for the 
> following (not using 'in' or 'or' in predicate 
> helped too): 
> select 
> /*+ INDEX(mv_birthstat,ndx_mvyr) */ 
>  brth_mthr_res_newco_code  County,count(*) 
> from mv_birthstat 
> where cert_chld_brth_year between '1995' and '1999' 
> and brth_mthr_res_state_code='10' 
> and brth_mthr_age between 15 and 41 
> group by brth_mthr_res_newco_code; 
> 
> Then adding the following the query takes 15 seconds 
> again - any ideas for 
> speeding it up?  Please don't say hire a new DBA.  I 
> have really been 
> working on this hard with only annoying input from 
> Oracle's technical 
> support and a lot of good reference manuals 
> (Jonathon Lewis, 101 Perf. 
> Tuning, Oracle SQL - Guy Harrison) for my 
> companions.  Great I know but 
> lonely.  
> 
> select 
> /*+ INDEX(mv_birthstat,ndx_mvyr) */ 
>  brth_mthr_res_newco_code  County 
>  sum(decode(greatest(cert_chld_birth_year,1995), 
> least(cert_chld_birth_year,1997), 1, 0)) / 3 Num1, 
>  sum(decode(greatest(cert_chld_birth_year,1996), 
> least(cert_chld_birth_year,1998), 1, 0)) / 3 Num2, 
>  sum(decode(greatest(cert_chld_birth_year,1997), 
> least(cert_chld_birth_year,1999), 1, 0)) / 3 Num3 
> from mv_birthstat 
> where cert_chld_brth_year between '1995' and '1999' 
> and brth_mthr_res_state_code='10' 
> and brth_mthr_age between 15 and 41 
> group by brth_mthr_res_newco_code; 
> 
> I am going to try the sums in a outer query.  
> 
> 
> 
> -----Original Message----- 
> Sent: Wednesday, August 07, 2002 4:45 PM 
> To: Stankus, Paula G; 'ORACLE-L@fatcity.com' 
> 
> 
> Mother's state 80% are in Florida.  However, this is 
> a 'local' prefixed 
> bitmap index.  I would expect to use year to 
> eliminate partion. then w/in 
> year by state - second col. in query. 
> 
> -----Original Message----- 
> Sent: Wednesday, August 07, 2002 4:35 PM 
> To: Stankus, Paula G; 'ORACLE-L@fatcity.com' 
> 
> 
> BTW, 
> 
> SQL> select blocks from dba_tables 
>   2  where table_name = 'MV_BIRTHSTAT'; 
> 
>     BLOCKS 
> ---------- 
>     236542 
> 
> SQL> select clustering_factor from user_indexes 
>   2  where table_name='MV_BIRTHSTAT'; 
> 
> CLUSTERING_FACTOR 
> ----------------- 
>              1657 
>               170 
> 
> -----Original Message----- 
> Sent: Wednesday, August 07, 2002 4:28 PM 
> To: Stankus, Paula G; 'ORACLE-L@fatcity.com' 
> 
> 
> Help - weird performance problem!!! 
> 
> 
----------------------------------------------------------------------------

> ---- 
> | Operation                 |  Name    |  Rows | 
> Bytes|  Cost  | Pstart| 
> Pstop | 
> 
----------------------------------------------------------------------------

> ---- 
> | SELECT STATEMENT          |          |     1 |   
> 5 |   9331 |       | 
> | 
> |  SORT AGGREGATE           |          |     1 |   
> 5 |        |       | 
> | 
> |   SORT AGGREGATE          |          |     1 |   
> 5 |        |       | 
> | 
> |    INLIST ITERATOR        |          |       |    
>  |        |       | 
> | 
> |     PARTITION RANGE ITERAT|          |       |    
>  |        |KEY(I) 
> |KEY(I) | 
> |      BITMAP CONVERSION COU|          |       |    
>  |        |       | 
> | 
> |       BITMAP INDEX RANGE S|NDX_MVYRS |       |    
>  |        |KEY(I) 
> |KEY(I) | 
> 
> Cost higher but less than a second. 
> 
> Ignore the cost - higher cost was sign. 
> Faster!!!!!Does Key(*) mean it is 
> doing part. Elimin.  I think so but can you see the 
> inlist? 
> 
> Very fast with all years involved.  Then added 
> predicate: 
> 
> select 
> /*+ INDEX(mv_birthstat,ndx_mvyrstatecoage) */ 
> count(*) from mv_birthstat 
> where cert_chld_brth_year 
> in('1995','1996','1997','1998','1999') 
>    and brth_MTHR_res_STATE_CODE = '10'; 
> 
> - snails crawl by just adding the additional 
> column!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
> 


__________________________________________________ 
Do You Yahoo!? 
Yahoo! Health - Feel better, live better 
http://health.yahoo.com <http://health.yahoo.com>  
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
<http://www.orafaq.com>  
-- 
Author: Jack Silvey 
  INET: jack_silvey@yahoo.com 

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: ListGuru@fatcity.com (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). 


------_=_NextPart_001_01C23EEE.700305A0
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<TITLE>RE: SOME SOLUTIONS!</TITLE>

<META content="MSHTML 5.00.3103.1000" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=498521415-08082002>Star 
schema will really, really help if you have bitmap indexes on your 
fact</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=498521415-08082002>and 
details tables.</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<P><FONT face=Arial size=2>Mladen Gogala</FONT> <BR><FONT face=Arial 
size=2>Oracle DBA</FONT> <BR><FONT face=Arial size=2>Phone: (203) 
459-6855</FONT> <BR><FONT face=Arial size=2>Email:&nbsp; mgogala@oxhp.com</FONT> 
</P>
<BLOCKQUOTE 
style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px">
  <DIV align=left class=OutlookMessageHeader dir=ltr><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> 
  Paula_Stankus@doh.state.fl.us 
  [mailto:Paula_Stankus@doh.state.fl.us]<BR><B>Sent:</B> Thursday, August 08, 
  2002 11:53 AM<BR><B>To:</B> Multiple recipients of list 
  ORACLE-L<BR><B>Subject:</B> RE: SOME SOLUTIONS!<BR><BR></DIV></FONT>
  <P><FONT size=2>Guys,</FONT> </P>
  <P><FONT size=2>Any ideas why sum - with same exec. plan and not going to disk 
  is 5 sec. response versus subsecond and anyway to get around this w/o building 
  a preaggregated data set since there are so many permutations 
  possible????&nbsp; Will I have to redesign to use STAR SCHEMA and will that 
  really help!!!</FONT></P>
  <P><FONT size=2>-----Original Message-----</FONT> <BR><FONT size=2>From: 
  Stankus, Paula G </FONT><BR><FONT size=2>Sent: Thursday, August 08, 2002 10:40 
  AM</FONT> <BR><FONT size=2>To: 'ORACLE-L@fatcity.com'</FONT> <BR><FONT 
  size=2>Subject: RE: SOME SOLUTIONS!</FONT> </P><BR>
  <P><FONT size=2>Okay, </FONT></P>
  <P><FONT size=2>Just going from #1 query to #2 query went from subsecond 
  response to 6 secs.&nbsp; Not to mention for each sum it gets progressively 
  worse!!!.&nbsp; The explain plan is exactly the same and I ran the sort query 
  below and no rows returned.</FONT></P>
  <P><FONT size=2>rem truncate table plan_table;</FONT> <BR><FONT size=2>set 
  timing on;</FONT> <BR><FONT size=2>rem explain plan set statement_id='RON' 
  for</FONT> <BR><FONT size=2>select</FONT> <BR><FONT size=2>/*+ 
  INDEX(mv_birthstat,ndx_mvyr) */</FONT> <BR><FONT 
  size=2>&nbsp;brth_mthr_res_newco_code&nbsp; County,count(*),</FONT> <BR><FONT 
  size=2>-- sum(cert_chld_brth_year) Num1</FONT> <BR><FONT 
  size=2>&nbsp;--sum(decode(greatest(cert_chld_brth_year,1996), 
  least(cert_chld_brth_year,1998</FONT> <BR><FONT size=2>), 1, 0)) / 3 
  Num2,</FONT> <BR><FONT 
  size=2>&nbsp;--sum(decode(greatest(cert_chld_brth_year,1997), 
  least(cert_chld_brth_year,1999</FONT> <BR><FONT size=2>), 1, 0)) / 3 
  Num3</FONT> <BR><FONT size=2>from mv_birthstat</FONT> <BR><FONT size=2>where 
  cert_chld_brth_year between '1995' and '1999'</FONT> <BR><FONT size=2>and 
  brth_mthr_res_state_code='10'</FONT> <BR><FONT size=2>and brth_mthr_age 
  between 15 and 41</FONT> <BR><FONT size=2>group by 
  brth_mthr_res_newco_code;</FONT> </P>
  <P><FONT size=2>/*+ INDEX(mv_birthstat,ndx_mvyr) */</FONT> <BR><FONT 
  size=2>&nbsp;brth_mthr_res_newco_code&nbsp; County,</FONT> <BR><FONT 
  size=2>&nbsp;sum(cert_chld_brth_year) Num1</FONT> <BR><FONT 
  size=2>&nbsp;--sum(decode(greatest(cert_chld_brth_year,1996), 
  least(cert_chld_brth_year,1998</FONT> <BR><FONT size=2>), 1, 0)) / 3 
  Num2,</FONT> <BR><FONT 
  size=2>&nbsp;--sum(decode(greatest(cert_chld_brth_year,1997), 
  least(cert_chld_brth_year,1999</FONT> <BR><FONT size=2>), 1, 0)) / 3 
  Num3</FONT> <BR><FONT size=2>from mv_birthstat</FONT> <BR><FONT size=2>where 
  cert_chld_brth_year between '1995' and '1999'</FONT> <BR><FONT size=2>and 
  brth_mthr_res_state_code='10'</FONT> <BR><FONT size=2>and brth_mthr_age 
  between 15 and 41</FONT> <BR><FONT size=2>group by 
  brth_mthr_res_newco_code;</FONT> </P><BR><BR>
  <P><FONT size=2>WHY WHY WHY WHY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</FONT> 
  <BR><FONT size=2>-----Original Message-----</FONT> <BR><FONT size=2>From: Jack 
  Silvey [<A 
  href="mailto:jack_silvey@yahoo.com">mailto:jack_silvey@yahoo.com</A>]</FONT> 
  <BR><FONT size=2>Sent: Wednesday, August 07, 2002 11:37 PM</FONT> <BR><FONT 
  size=2>To: Multiple recipients of list ORACLE-L</FONT> <BR><FONT 
  size=2>Subject: RE: SOME SOLUTIONS!</FONT> </P><BR>
  <P><FONT size=2>Paula,</FONT> </P>
  <P><FONT size=2>Sorry to join this thread late, if I am rehashing just</FONT> 
  <BR><FONT size=2>igonre.</FONT> </P>
  <P><FONT size=2>I notice that your 'numbers' are surrounded by quotes,</FONT> 
  <BR><FONT size=2>which will implicitly disable the index on those</FONT> 
  <BR><FONT size=2>columns, perhaps the cause of the index hint. Are</FONT> 
  <BR><FONT size=2>those columns text or numbers? If numbers, take out</FONT> 
  <BR><FONT size=2>the quotes (and perhaps the hint) and rerun query.</FONT> 
</P>
  <P><FONT size=2>Also, your aggregate functions will cause sorting -</FONT> 
  <BR><FONT size=2>are you sorting to disk? See the query at the end of</FONT> 
  <BR><FONT size=2>this to find out. If so, perhaps a larger</FONT> <BR><FONT 
  size=2>sort_area_size and sort_area_retained_size might be in</FONT> <BR><FONT 
  size=2>order.</FONT> </P>
  <P><FONT size=2>Again, ignore if redundant.</FONT> </P>
  <P><FONT size=2>Run this to look at sorting:</FONT> </P>
  <P><FONT size=2>select t1.tablespace </FONT><BR><FONT size=2>, extents</FONT> 
  <BR><FONT size=2>, sum( t1.blocks * to_number( t3.value ) ) / 1024 /</FONT> 
  <BR><FONT size=2>1024 mb_used </FONT><BR><FONT size=2>, sum( t1.extents ) 
  tot_extents </FONT><BR><FONT size=2>, t2.username </FONT><BR><FONT size=2>, 
  t2.osuser </FONT><BR><FONT size=2>, t2.SID ||','|| t2.serial# SID_PID 
  </FONT><BR><FONT size=2>, t4.spid </FONT><BR><FONT size=2>, t5.sql_text</FONT> 
  <BR><FONT size=2>, t1.segtype</FONT> <BR><FONT size=2>from </FONT><BR><FONT 
  size=2>v$sort_usage t1 </FONT><BR><FONT size=2>,v$session t2 </FONT><BR><FONT 
  size=2>,v$parameter t3 </FONT><BR><FONT size=2>,v$process t4 </FONT><BR><FONT 
  size=2>,v$sqlarea t5</FONT> <BR><FONT size=2>where t1.SESSION_ADDR = t2.SADDR 
  </FONT><BR><FONT size=2>and t3.name = 'db_block_size' </FONT><BR><FONT 
  size=2>and (t2.PROCESS=t4.SPID or t2.paddr = t4.addr) </FONT><BR><FONT 
  size=2>and t2.sql_address=t5.address</FONT> <BR><FONT size=2>and t2.status = 
  'ACTIVE'</FONT> <BR><FONT size=2>group by </FONT><BR><FONT 
  size=2>t1.tablespace </FONT><BR><FONT size=2>, t2.username </FONT><BR><FONT 
  size=2>, t2.osuser </FONT><BR><FONT size=2>, t2.machine </FONT><BR><FONT 
  size=2>, t2.schemaname </FONT><BR><FONT size=2>, t2.program </FONT><BR><FONT 
  size=2>, t2.SID ||','|| t2.serial# </FONT><BR><FONT size=2>, t4.spid</FONT> 
  <BR><FONT size=2>, t5.sql_text</FONT> <BR><FONT size=2>, t1.segtype</FONT> 
  <BR><FONT size=2>, segfile#</FONT> <BR><FONT size=2>, extents</FONT> <BR><FONT 
  size=2>/</FONT> </P><BR>
  <P><FONT size=2>hth, </FONT></P>
  <P><FONT size=2>Jack</FONT> </P>
  <P><FONT size=2>--- Paula_Stankus@doh.state.fl.us wrote:</FONT> <BR><FONT 
  size=2>&gt; Guys,</FONT> <BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; By 
  changing objects to noparallel, creating</FONT> <BR><FONT size=2>&gt; 
  bitmapped index containing all</FONT> <BR><FONT size=2>&gt; columns that was 
  local and prefixed.&nbsp; Moving to</FONT> <BR><FONT size=2>&gt; 8.1.7.4 I was 
  able to</FONT> <BR><FONT size=2>&gt; improve performance from minutes to many 
  seconds to</FONT> <BR><FONT size=2>&gt; seconds for the</FONT> <BR><FONT 
  size=2>&gt; following (not using 'in' or 'or' in predicate</FONT> <BR><FONT 
  size=2>&gt; helped too):</FONT> <BR><FONT size=2>&gt; select</FONT> <BR><FONT 
  size=2>&gt; /*+ INDEX(mv_birthstat,ndx_mvyr) */</FONT> <BR><FONT 
  size=2>&gt;&nbsp; brth_mthr_res_newco_code&nbsp; County,count(*)</FONT> 
  <BR><FONT size=2>&gt; from mv_birthstat</FONT> <BR><FONT size=2>&gt; where 
  cert_chld_brth_year between '1995' and '1999'</FONT> <BR><FONT size=2>&gt; and 
  brth_mthr_res_state_code='10'</FONT> <BR><FONT size=2>&gt; and brth_mthr_age 
  between 15 and 41</FONT> <BR><FONT size=2>&gt; group by 
  brth_mthr_res_newco_code;</FONT> <BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt; Then adding the following the query takes 15 seconds</FONT> 
  <BR><FONT size=2>&gt; again - any ideas for</FONT> <BR><FONT size=2>&gt; 
  speeding it up?&nbsp; Please don't say hire a new DBA.&nbsp; I</FONT> 
  <BR><FONT size=2>&gt; have really been</FONT> <BR><FONT size=2>&gt; working on 
  this hard with only annoying input from</FONT> <BR><FONT size=2>&gt; Oracle's 
  technical</FONT> <BR><FONT size=2>&gt; support and a lot of good reference 
  manuals</FONT> <BR><FONT size=2>&gt; (Jonathon Lewis, 101 Perf.</FONT> 
  <BR><FONT size=2>&gt; Tuning, Oracle SQL - Guy Harrison) for my</FONT> 
  <BR><FONT size=2>&gt; companions.&nbsp; Great I know but</FONT> <BR><FONT 
  size=2>&gt; lonely.&nbsp; </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt; select</FONT> <BR><FONT size=2>&gt; /*+ 
  INDEX(mv_birthstat,ndx_mvyr) */</FONT> <BR><FONT size=2>&gt;&nbsp; 
  brth_mthr_res_newco_code&nbsp; County</FONT> <BR><FONT size=2>&gt;&nbsp; 
  sum(decode(greatest(cert_chld_birth_year,1995),</FONT> <BR><FONT size=2>&gt; 
  least(cert_chld_birth_year,1997), 1, 0)) / 3 Num1,</FONT> <BR><FONT 
  size=2>&gt;&nbsp; sum(decode(greatest(cert_chld_birth_year,1996),</FONT> 
  <BR><FONT size=2>&gt; least(cert_chld_birth_year,1998), 1, 0)) / 3 
  Num2,</FONT> <BR><FONT size=2>&gt;&nbsp; 
  sum(decode(greatest(cert_chld_birth_year,1997),</FONT> <BR><FONT size=2>&gt; 
  least(cert_chld_birth_year,1999), 1, 0)) / 3 Num3</FONT> <BR><FONT size=2>&gt; 
  from mv_birthstat</FONT> <BR><FONT size=2>&gt; where cert_chld_brth_year 
  between '1995' and '1999'</FONT> <BR><FONT size=2>&gt; and 
  brth_mthr_res_state_code='10'</FONT> <BR><FONT size=2>&gt; and brth_mthr_age 
  between 15 and 41</FONT> <BR><FONT size=2>&gt; group by 
  brth_mthr_res_newco_code;</FONT> <BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt; I am going to try the sums in a outer query.&nbsp; 
  </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt; </FONT><BR><FONT size=2>&gt; -----Original Message-----</FONT> 
  <BR><FONT size=2>&gt; Sent: Wednesday, August 07, 2002 4:45 PM</FONT> 
  <BR><FONT size=2>&gt; To: Stankus, Paula G; 'ORACLE-L@fatcity.com'</FONT> 
  <BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt; Mother's state 80% are in Florida.&nbsp; However, this is</FONT> 
  <BR><FONT size=2>&gt; a 'local' prefixed</FONT> <BR><FONT size=2>&gt; bitmap 
  index.&nbsp; I would expect to use year to</FONT> <BR><FONT size=2>&gt; 
  eliminate partion. then w/in</FONT> <BR><FONT size=2>&gt; year by state - 
  second col. in query.</FONT> <BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt; -----Original Message-----</FONT> <BR><FONT size=2>&gt; Sent: 
  Wednesday, August 07, 2002 4:35 PM</FONT> <BR><FONT size=2>&gt; To: Stankus, 
  Paula G; 'ORACLE-L@fatcity.com'</FONT> <BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt; </FONT><BR><FONT size=2>&gt; BTW,</FONT> <BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; SQL&gt; select blocks from dba_tables</FONT> 
  <BR><FONT size=2>&gt;&nbsp;&nbsp; 2&nbsp; where table_name = 
  'MV_BIRTHSTAT';</FONT> <BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; BLOCKS</FONT> <BR><FONT size=2>&gt; 
  ----------</FONT> <BR><FONT size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 236542</FONT> 
  <BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; SQL&gt; select 
  clustering_factor from user_indexes</FONT> <BR><FONT size=2>&gt;&nbsp;&nbsp; 
  2&nbsp; where table_name='MV_BIRTHSTAT';</FONT> <BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; CLUSTERING_FACTOR</FONT> <BR><FONT size=2>&gt; 
  -----------------</FONT> <BR><FONT 
  size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  1657</FONT> <BR><FONT 
  size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  170</FONT> <BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; -----Original 
  Message-----</FONT> <BR><FONT size=2>&gt; Sent: Wednesday, August 07, 2002 
  4:28 PM</FONT> <BR><FONT size=2>&gt; To: Stankus, Paula G; 
  'ORACLE-L@fatcity.com'</FONT> <BR><FONT size=2>&gt; </FONT><BR><FONT 
  size=2>&gt; </FONT><BR><FONT size=2>&gt; Help - weird performance 
  problem!!!</FONT> <BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt;</FONT> 
  <BR><FONT 
  size=2>----------------------------------------------------------------------------</FONT> 
  <BR><FONT size=2>&gt; ----</FONT> <BR><FONT size=2>&gt; | 
  Operation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp; Name&nbsp;&nbsp;&nbsp; |&nbsp; Rows |</FONT> <BR><FONT size=2>&gt; 
  Bytes|&nbsp; Cost&nbsp; | Pstart|</FONT> <BR><FONT size=2>&gt; Pstop |</FONT> 
  <BR><FONT size=2>&gt;</FONT> <BR><FONT 
  size=2>----------------------------------------------------------------------------</FONT> 
  <BR><FONT size=2>&gt; ----</FONT> <BR><FONT size=2>&gt; | SELECT 
  STATEMENT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp; 1 |&nbsp;&nbsp; </FONT><BR><FONT size=2>&gt; 5 
  |&nbsp;&nbsp; 9331 |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</FONT> <BR><FONT 
  size=2>&gt; |</FONT> <BR><FONT size=2>&gt; |&nbsp; SORT 
  AGGREGATE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp; 1 |&nbsp;&nbsp; </FONT><BR><FONT size=2>&gt; 5 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</FONT> <BR><FONT size=2>&gt; |</FONT> 
  <BR><FONT size=2>&gt; |&nbsp;&nbsp; SORT 
  AGGREGATE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp; 1 |&nbsp;&nbsp; </FONT><BR><FONT size=2>&gt; 5 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</FONT> <BR><FONT size=2>&gt; |</FONT> 
  <BR><FONT size=2>&gt; |&nbsp;&nbsp;&nbsp; INLIST 
  ITERATOR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; </FONT><BR><FONT 
  size=2>&gt;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</FONT> <BR><FONT size=2>&gt; |</FONT> 
  <BR><FONT size=2>&gt; |&nbsp;&nbsp;&nbsp;&nbsp; PARTITION RANGE 
  ITERAT|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; </FONT><BR><FONT 
  size=2>&gt;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |KEY(I)</FONT> 
  <BR><FONT size=2>&gt; |KEY(I) |</FONT> <BR><FONT size=2>&gt; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BITMAP CONVERSION 
  COU|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; </FONT><BR><FONT 
  size=2>&gt;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</FONT> <BR><FONT size=2>&gt; |</FONT> 
  <BR><FONT size=2>&gt; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BITMAP INDEX RANGE 
  S|NDX_MVYRS |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; 
  </FONT><BR><FONT size=2>&gt;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  |KEY(I)</FONT> <BR><FONT size=2>&gt; |KEY(I) |</FONT> <BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; Cost higher but less than a second.</FONT> 
  <BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; Ignore the cost - higher 
  cost was sign.</FONT> <BR><FONT size=2>&gt; Faster!!!!!Does Key(*) mean it 
  is</FONT> <BR><FONT size=2>&gt; doing part. Elimin.&nbsp; I think so but can 
  you see the</FONT> <BR><FONT size=2>&gt; inlist?</FONT> <BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; Very fast with all years involved.&nbsp; Then 
  added</FONT> <BR><FONT size=2>&gt; predicate:</FONT> <BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; select</FONT> <BR><FONT size=2>&gt; /*+ 
  INDEX(mv_birthstat,ndx_mvyrstatecoage) */</FONT> <BR><FONT size=2>&gt; 
  count(*) from mv_birthstat</FONT> <BR><FONT size=2>&gt; where 
  cert_chld_brth_year</FONT> <BR><FONT size=2>&gt; 
  in('1995','1996','1997','1998','1999')</FONT> <BR><FONT 
  size=2>&gt;&nbsp;&nbsp;&nbsp; and brth_MTHR_res_STATE_CODE = '10';</FONT> 
  <BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; - snails crawl by just 
  adding the additional</FONT> <BR><FONT size=2>&gt; 
  column!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</FONT> <BR><FONT size=2>&gt; 
  </FONT></P><BR>
  <P><FONT size=2>__________________________________________________</FONT> 
  <BR><FONT size=2>Do You Yahoo!?</FONT> <BR><FONT size=2>Yahoo! Health - Feel 
  better, live better</FONT> <BR><FONT size=2><A href="http://health.yahoo.com" 
  target=_blank>http://health.yahoo.com</A></FONT> <BR><FONT size=2>-- 
  </FONT><BR><FONT size=2>Please see the official ORACLE-L FAQ: <A 
  href="http://www.orafaq.com" target=_blank>http://www.orafaq.com</A></FONT> 
  <BR><FONT size=2>-- </FONT><BR><FONT size=2>Author: Jack Silvey</FONT> 
  <BR><FONT size=2>&nbsp; INET: jack_silvey@yahoo.com</FONT> </P>
  <P><FONT size=2>Fat City Network Services&nbsp;&nbsp;&nbsp; -- (858) 
  538-5051&nbsp; FAX: (858) 538-5051</FONT> <BR><FONT size=2>San Diego, 
  California&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Public Internet access 
  / Mailing Lists</FONT> <BR><FONT 
  size=2>--------------------------------------------------------------------</FONT> 
  <BR><FONT size=2>To REMOVE yourself from this mailing list, send an E-Mail 
  message</FONT> <BR><FONT size=2>to: ListGuru@fatcity.com (note EXACT spelling 
  of 'ListGuru') and in</FONT> <BR><FONT size=2>the message BODY, include a line 
  containing: UNSUB ORACLE-L</FONT> <BR><FONT size=2>(or the name of mailing 
  list you want to be removed from).&nbsp; You may</FONT> <BR><FONT size=2>also 
  send the HELP command for other information (like subscribing).</FONT> 
</P></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C23EEE.700305A0--
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Gogala, Mladen
  INET: MGogala@oxhp.com

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: ListGuru@fatcity.com (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).

