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

Home -> Community -> Usenet -> c.d.o.server -> Re: programmatically updating table statistics

Re: programmatically updating table statistics

From: DA Morgan <damorgan_at_psoug.org>
Date: Fri, 07 Dec 2007 14:19:59 -0800
Message-ID: <1197065998.985563@bubbleator.drizzle.com>


Wisser wrote:
> Hi,
>
> is it possible to programmatically update table statistics by
> executing SQL-statements via Jdbc-driver?
> My DB-application fills an initially empty table with a huge number of
> rows and I try to speed-up the application by keeping the table-
> statistics uptodate.
>
> Thanks,
> Ralf

If you do it with SQL statements you can pretty much throw your support agreement with Oracle into the toilet. If they find out you will have cost your company a large sum of money.

You can change them by a either running stats jobs with DBMS_STATS such as:

gather_table_stats
gather_schema_stats
gather_index_stats

etc.

Or you, again using DBMS_STATS, you can export and import stats from other databases

Or you, again using DBMS_STATS, you can tell the optimizer what stats to use as in:
exec dbms_stats.set_table_stats(USER, 'EMP', numrows=>1000000, numblks=>10000, avgrlen=>74);

exec dbms_stats.set_index_stats(USER, 'ix_emp_deptno', numrows=>1000000, numlblks=>1000, numdist=>10000, clstfct=>1);

Demonstrated here: http://www.psoug.org/reference/tuning.html

-- 
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Fri Dec 07 2007 - 16:19:59 CST

Original text of this message

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