My Oracle Support Banner

Why DBMS_STATS with METHOD_OPT=>'FOR ALL COLUMNS SIZE SKEWONLY' Gathers Histograms on Unique Key Columns (Doc ID 1473023.1)

Last updated on FEBRUARY 21, 2019

Applies to:

Oracle Database - Enterprise Edition - Version 9.2.0.1 and later
Oracle Database - Personal Edition - Version 9.2.0.1 and later
Oracle Database - Standard Edition - Version 9.2.0.1 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Information in this document applies to any platform.

Goal

Why are column statistics gathered for a Unique or Primary Key column?
How can a Unique column's data be non-uniformly distributed?

Gathering stats with METHOD_OPT=>'FOR ALL COLUMNS SIZE SKEWONLY' generates histogram for unique key/Primary key columns.
This may appear to contradict with what is mentioned in documentation, as per documentation SKEWONLY--Oracle determines the columns to collect histograms based on the data distribution of the columns.

Example Testcase
Gather stats for a table using the below commands

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.