# 22. Virtuoso Functions Guide - sys_stat_analyze

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_analyze

Collects statistics on a table and its columns for use in SQL optinmization
sys_stat_analyze (in table_name varchar, [in pcnt integer], [in ignore_vdb integer]);
Description

This function collects (or updates) column statistics for the table columns. It collects minimum, maximum average and distinct values for a column and a row count for the table and inserts the data into the DB.DBA.SYS_COL_STAT table. It does not make historgrams for the columns.

The statistics 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.

This function will normally consider the entire database with the exception of remote tables. Since you may be concerned about time or remote tables this operation is configurable using the optional parameters, pcnt and ignore_vdb.

Parameters
table_name – The full name of the table exactly as in the KEY_TABLE column of SYS_KEYS.
pcnt – Determines the sample size for statistics gathering. A value of 0 will read the whole table. The default is 5, for an approximately five percentsample of the table.
ignore_vdb – Determines whether remote tables are considered. By default remote tables (ignore_vdb = 1) are ignored. Setting this value to 0 will cause this function to gather statistical information for remote tables also. A percentage of 0 will read the remote table from beginning to end. A non-zero percentage will access the statistics tables of the remote DBMS if it is of a supported type, see the sys_stat_vdb_mappers table.
See Also

sys_stat_histogram

SYS_DB_STAT()