ASA Database Administration Guide
Database Administration Utilities
The Histogram utility
dbhist [ options ] -t table-name [ excel-output-name ]
Optional options | Description |
---|---|
-c options | Connection string. |
-n colname | Column to associate with the histogram |
-u owner | The table owner |
-t table-name | The name of the table to generate histograms for |
excel-output-name: | The name of the generated Excel file. If no name is specified, Excel prompts you to enter one with a Save As dialog. |
Histograms are stored in the SYSCOLSTAT system table and can also be retrieved with the sa_get_histogram stored procedure. The Histogram utility converts a histogram into a Microsoft Excel chart containing information about the selectivity of predicates. The utility only works with Excel 97 and higher, and only on Windows.
To determine the selectivity of a predicate over a string column, you should use the ESTIMATE or ESTIMATE_SOURCE functions. Attempting to retrieve a histogram from string columns causes both sa_get_histogram and the Histogram utility to generate an error.
Exit codes are 0 (success) or non-zero (failure).
For more information about the sa_get_histogram stored procedure, see sa_get_histogram system procedure.
This utility accepts @filename parameters. For more information, see @filename server option.
Assuming that a histogram has been created for the column, the following statement (entered all on the same line) generates an Excel chart for the column prod_id in the table sales_order_items for database asademo.db, and saves it as histgram.xls.
dbhist -c "uid=DBA;pwd=SQL;dbf=asademo.db" -n prod_id -t sales_order_items histgram.xls
The following statement generates charts for every column with a histogram in the table sales_order, assuming that asademo is already loaded. This statement also attempts to connect using uid=dba, pwd=sql. No output file name is specified, so Excel prompts you to enter one.
dbhist -t sales_order