# 22. Virtuoso Functions Guide - sys_stat_histogram

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
__any_grants
close
collation_define
complete_table_name
delay
end_result
exec
exec_next
exec_result
exec_result_names
identity_value
name_part
registry_get
registry_get_all
registry_name_is_pro...
registry_remove
registry_set
result
result_names
row_count
sequence_get_all
sequence_next
sequence_remove
sequence_set
set_identity_column
set_row_count
set_user_id
signal
sinv_create_inverse
sinv_create_key_mapp...
sinv_drop_inverse
sys_stat_analyze
sys_stat_histogram
table_drop_policy
table_set_policy
username
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## sys_stat_histogram

Collects a column value histogram for use in SQL optimization
sys_stat_histogram (in table_name varchar, in column_name varchar, in n_buckets integer, [in prec integer]);
Description

This function collects (or updates) values distribution data for a given column.

It splits the sorted column values in n_buckets intervals and collects the last value of each interval. The values are then inserted into the SYS_COL_HIST table.

If the table in question has not been analyzed, then it calls SYS_STAT_ANALYZE for the table.

The histograms are then used by the Optimized SQL compiler. All the cached compilations are discarded, because some of them may compile differently in the light of the new data.

Parameters
table_name – The full name of the table exactly as in the KEY_TABLE column of SYS_KEYS.
column_name – The full name of the column exactly as in the COLUMN column in SYS_COLS.
n_buckets – How much intervals to form. If more intervals are available, the estimation of column predicates costs is more precise.
prec – The density of the rows examined. Defaults to 1 (all the rows)
See Also

SYS_DB_STAT()

sys_stat_analyze