nerdexam
Oracle

1Z0-052 · Question #157

Examine the command: SQL>DBMS_STATS.SET_TABLE_PREFS('SH','CUSTOMERS','PUBLISH','false'); Which statement describes the effect of the above command?

The correct answer is D. Subsequently, statistics gathered on the CUSTOMERS table are stored as pending statistics. The DBMS_STATS.SET_TABLE_PREFS procedure with the PUBLISH preference set to 'false' causes future gathered statistics to be stored as pending rather than immediately published to the data dictionary.

Managing Schema Objects

Question

Examine the command:

SQL>DBMS_STATS.SET_TABLE_PREFS('SH','CUSTOMERS','PUBLISH','false'); Which statement describes the effect of the above command?

Options

  • AAutomatic statistics collection is stopped for the CUSTOMERS table
  • BStatistics for the CUSTOMERS table are locked and cannot be overwritten
  • CExisting statistics for the CUSTOMERS table become unusable for the query optimizer
  • DSubsequently, statistics gathered on the CUSTOMERS table are stored as pending statistics

How the community answered

(23 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    13% (3)
  • D
    78% (18)

Why each option

The DBMS_STATS.SET_TABLE_PREFS procedure with the PUBLISH preference set to 'false' causes future gathered statistics to be stored as pending rather than immediately published to the data dictionary.

AAutomatic statistics collection is stopped for the CUSTOMERS table

Setting PUBLISH to 'false' does not disable automatic statistics collection - the AUTOSTATS job still runs, but results are stored as pending instead of being published.

BStatistics for the CUSTOMERS table are locked and cannot be overwritten

Locking statistics to prevent overwriting requires DBMS_STATS.LOCK_TABLE_STATS or LOCK_SCHEMA_STATS, not the PUBLISH preference.

CExisting statistics for the CUSTOMERS table become unusable for the query optimizer

Existing published statistics in the data dictionary remain valid and usable by the optimizer - only future gathered statistics are redirected to the pending area.

DSubsequently, statistics gathered on the CUSTOMERS table are stored as pending statisticsCorrect

When the PUBLISH preference is set to 'false' using DBMS_STATS.SET_TABLE_PREFS, any statistics subsequently gathered on the CUSTOMERS table are stored in the pending statistics area (USER_TAB_PENDING_STATS) rather than being immediately written to the data dictionary. These pending statistics do not affect the query optimizer until explicitly published via DBMS_STATS.PUBLISH_PENDING_STATS, allowing DBAs to test new statistics before committing them.

Concept tested: Oracle pending statistics with DBMS_STATS PUBLISH preference

Source: https://docs.oracle.com/en/database/oracle/oracle-database/19/arpls/DBMS_STATS.html

Topics

#DBMS_STATS#pending statistics#SET_TABLE_PREFS#PUBLISH preference

Community Discussion

No community discussion yet for this question.

Full 1Z0-052 Practice