Skip to Main Content
  • Questions
  • Limit DOP of automatic statistics gathering

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Ralf.

Asked: December 11, 2016 - 3:17 pm UTC

Last updated: December 15, 2016 - 5:09 am UTC

Version: 11.2.0.4.0

Viewed 1000+ times

You Asked

Tom -

we run a 11.2.0.4.0 RAC database with Automatic DOP enabled. The 2 rack nodes have 16 CPU cores each (32 with Hyperthreading) and 128GB of RAM.
The database did run smoothly for over a year. The OS is Redhat Enterprise Linux 6.5 on both nodes.

About one month ago we partitioned the 2 largest tables (2 billion lines in the biggest, 1.4 billion lines in the smaller one) in our database and did run into problems with too much parallel query slaves since that for a couple of times. We have about 750 partitions per table (one partition per day of loaded data).

We realized that since the tables have been partitioned Oracle throws parallel queries with a DOP of 128 at those tables.
Some of those queries involve joins with other tables and a sorting clause. This results in a process count of 128 * N
per RAC node (N depending on number of joins, etc.). Since these queries can be issued by multiple user sessions at the
same time this totally overwhelmed the nodes. We saw a load of > 350 on both Linux hosts.

We got rid of this problem by setting PARALLEL_DEGREE_LIMIT = 8 on system level. This helped for the queries generated by the application.

However, then the optimizer gathers statistics it still throws queries with a DOP of 128 at those tables effectively
ignoring the PARALLEL_DEGREE_LIMIT set on system level. This again overwhelms the RAC nodes. So other sessions run into
timeouts or SSH connections are closed.

So the question is:
Is there any way to effectively limit the DOP used by the optimizer when gathering statistics when PARALLEL_DEGREE_LIMIT is
ignored?


Best regards,
Ralf

and Connor said...

Have you tried explicitly setting the DEGREE parameter for these particular tables ? either in the call, or as a preference ?


Rating

  (3 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Fixing DEGREE on tables does not help

Ralf, December 12, 2016 - 9:07 am UTC

Hi,

yes, we tried to use a fixed DEGREE on both tables. One table has DEGREE = 1 and the other DEGREE = 32. Both seem to be ignored by the optimizer when gathering statistics.

Best regards,
Ralf

Connor McDonald
December 13, 2016 - 3:29 am UTC

can we get

show parameter parallel

from all instances

A reader, December 12, 2016 - 7:09 pm UTC

DBMS_STATS.SET_*_PREFS(DEGREE).

Using DBMS_STATS.SET_TABLE_PREFS() does the trick

Ralf, December 13, 2016 - 9:30 am UTC

Hi all,

yes, the optimizer ignores the limit imposed by PARALLEL_DEGREE_LIMIT when gathering statistics.
We have to adjust the DOP used on those tables for statistics gathering using the mentioned DBMS_STATS.SET_*_PREFS() procedures.

The PARALLEL* parameters are:

SQL> select userenv('instance') from dual;

USERENV('INSTANCE')
-------------------
1

SQL> show parameter parallel

NAME TYPE VALUE
------------------------------------ -------------------------------- ------------
fast_start_parallel_rollback string LOW
parallel_adaptive_multi_user boolean TRUE
parallel_automatic_tuning boolean FALSE
parallel_degree_limit string 8
parallel_degree_policy string AUTO
parallel_execution_message_size integer 16384
parallel_force_local boolean FALSE
parallel_instance_group string
parallel_io_cap_enabled boolean FALSE
parallel_max_servers integer 1280
parallel_min_percent integer 0
parallel_min_servers integer 0
parallel_min_time_threshold string AUTO
parallel_server boolean TRUE
parallel_server_instances integer 2
parallel_servers_target integer 512
parallel_threads_per_cpu integer 2
recovery_parallelism integer 0



SQL> select userenv('instance') from dual;

USERENV('INSTANCE')
-------------------
2

SQL> show parameter parallel

NAME TYPE VALUE
------------------------------------ -------------------------------- -----------
fast_start_parallel_rollback string LOW
parallel_adaptive_multi_user boolean TRUE
parallel_automatic_tuning boolean FALSE
parallel_degree_limit string 8
parallel_degree_policy string AUTO
parallel_execution_message_size integer 16384
parallel_force_local boolean FALSE
parallel_instance_group string
parallel_io_cap_enabled boolean FALSE
parallel_max_servers integer 1280
parallel_min_percent integer 0
parallel_min_servers integer 0
parallel_min_time_threshold string AUTO
parallel_server boolean TRUE
parallel_server_instances integer 2
parallel_servers_target integer 512
parallel_threads_per_cpu integer 2
recovery_parallelism integer 0

Regards,
Ralf

Connor McDonald
December 15, 2016 - 5:09 am UTC

I'm glad the set_table_pref has assisted.

Admittedly, we've got so many variations of the parallel parameters nowadays, its tough to keep up (well...I know *I* find it tough).

Similarly, the prefs could be picked up at table, schema or database level, and "auto" degree then defers to what we find on the table etc (plus the 'concurrent' setting as well from 11.2 onwards).

If you trace the dbms_stats calls, it would be interesting to see if you are getting a "parallel" hint in the generated sql's, or a "parallel(n)" hint. The latter (I think) would override any parallel_degree_limit set


More to Explore

Performance

Get all the information about database performance in the Database Performance guide.