Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> analyze vs dbms_stats

analyze vs dbms_stats

From: David <thump_at_cosmiccooler.org>
Date: Fri, 25 Jun 2004 09:37:03 -0700 (PDT)
Message-ID: <3815.64.37.153.21.1088181423.squirrel@www.cosmiccooler.org>


I'm trying to get our shop to convert from analyze to dbms_stats. I'm running into some "strange" results though and wanted to see if I'm missing something or you have some advice.

analyze command:
ESTIMATE STATISTICS SAMPLE 30
 PERCENT
 FOR TABLE FOR ALL INDEXES FOR ALL INDEXED COLUMNS SIZE 254 dbms_stats code I'm running:
exec DBMS_STATS.GATHER_TABLE_STATS ( -

   ownname    =>    'STATION_TEST', -
   tabname    =>    'MEMBERS', -
   partname   =>    NULL, -

   estimate_percent => 30, -
   block_sample => FALSE, -
   method_opt => 'FOR ALL COLUMNS SIZE 254', -
   degree      =>     0, -
   granularity =>    'DEFAULT', -
   cascade     =>   TRUE, -
   stattab     =>  NULL, -
   statid      => NULL, -
   statown     =>    NULL, -

   no_invalidate => FALSE);

sample of stats info from analyze:
Table STATION_TEST.MEMBERS

- Number of rows     : 14284780
- Number of blocks   : 1623961
- Average row length : 192

  Column RESTRICTION_CODE

  Column DAY_PHONE

  Column EVE_PHONE

  Column ISP_ID

sample of dbms stats generated statistics: Table STATION_TEST.MEMBERS

- Number of rows     : 14283597
- Number of blocks   : 1623961
- Average row length : 193

  Column RESTRICTION_CODE

  Column DAY_PHONE

  Column EVE_PHONE

  Column ISP_ID

  Column USER_ID (NOT NULL)

As it turns out analyze in this test is far more accurate. For instance eve_phone actually has 66 distinct values. Any ideas on the disparity? I am going to try compute, but apples to apples reflect a big diff...
Thanks
- David



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Fri Jun 25 2004 - 11:33:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US