Databases Reference
In-Depth Information
6.
Create histograms for column
FIELD2
of the table
TEST_HIST
:
EXEC DBMS_STATS.GATHER_TABLE_STATS (OWNNAME => 'SH', -
TABNAME => 'TEST_HIST', -
METHOD_OPT => 'FOR COLUMNS SIZE 10 FIELD2');
7.
Query
USER_TAB_HISTOGRAMS
to see the values stored in the histogram for
FIELD2
:
SELECT ENDPOINT_NUMBER, ENDPOINT_VALUE
FROM USER_TAB_HISTOGRAMS
WHERE TABLE_NAME = 'TEST_HIST' AND COLUMN_NAME = 'FIELD2'
ORDER BY 2;
8.
Drop the table
TEST_HIST
:
DROP TABLE TEST_HIST;
How it works...
In step 2, we created the table
TEST_HIST
, in which
FIELD1
is populated with values
ranging from 0 to 9 and
FIELD2
contains only the values 0 and 1, with a 9:1 ratio.
We confirm the data distribution we just saw with the queries in step 3. The output can
be seen in the following screenshot: