dbms_stats.gather_database_stats_job_proc
469753Dec 9 2005 — edited Feb 8 2010I like the fact that dbms_stats.gather_database_stats_job_proc will prioritze the gathering of optimizer stats, but I have a small number of tables (2) that get loaded, processed and truncated. The nature of this activity makes them always included in the gathering of new stats, but when this job runs, the tables are empty. This makes the optimizer assume these 2 tables are small and does dumb things with execution plans during processing of the data.
I can manually gather stats when these tables have thousands of rows, so the optimizer can choose well during the processing of data. But, how do I lock in these "good" stats so the gather_database_stats_job_proc doesn't clobber them.
I really don't want to turn off the automatic collection of stats and "roll my own"- I don't want to have to reinvent the wheel for the sake of these 2 tables.