sybase update statistics
DESCRIPTION
The update statistics command explainedTRANSCRIPT
![Page 1: Sybase Update Statistics](https://reader031.vdocuments.us/reader031/viewer/2022013118/54667d55b4af9f91518b4cb3/html5/thumbnails/1.jpg)
![Page 2: Sybase Update Statistics](https://reader031.vdocuments.us/reader031/viewer/2022013118/54667d55b4af9f91518b4cb3/html5/thumbnails/2.jpg)
The update statistics command gathers information about the distribution of key values in specified indexes, for all columns in an index, table, or partition. ‘Statistics’ help the ASE optimizer make decisions about which indexes to use during query processing. Typically, We have to use update statistics when data profile of a table changes.
*
![Page 3: Sybase Update Statistics](https://reader031.vdocuments.us/reader031/viewer/2022013118/54667d55b4af9f91518b4cb3/html5/thumbnails/3.jpg)
update statistics updates/creates table statistics stored in systabstats and sysstatistics.If you run the command for a specific data partition, statistics are generated and updated only for that data partition and for any local index partitions. If you run update statistics for a specific index partition, only the statistics for that index partition are updated.*** Permission to issue the update statistics command defaults to the table owner.
Sybase Update Statistics
![Page 4: Sybase Update Statistics](https://reader031.vdocuments.us/reader031/viewer/2022013118/54667d55b4af9f91518b4cb3/html5/thumbnails/4.jpg)
update statistics table_name [index_name] with sampling = N percentUpdates statistics on the leading columns of all indexes on the specified table or partition or the leading column of a specified index.
Syntaxupdate statistics table_name
[[ partition data_partition_name ] [ (column_list ) ] |
index_name [ partition index_partition_name ] ]
[ using step values ][ with consumers = consumers ][, sampling=N
percent ]
Sybase Update Statistics
![Page 5: Sybase Update Statistics](https://reader031.vdocuments.us/reader031/viewer/2022013118/54667d55b4af9f91518b4cb3/html5/thumbnails/5.jpg)
update index statistics Updates statistics on all columns of all indexes on the table or of the specified index. If sampling is specified, it is used to gather statistics on the non-leading index columns. Why is this important ?
Syntax:update index statistics table_name [[ partition data_partition_name ] | [ index_name [ partition index_partition_name ] ] ] [ using step values ] [ with consumers = consumers ] [, sampling=N percent]
Sybase Update Statistics
Non-leading columns are read into a worktable & sorted for updating statistics. The additional work can be reduced when sampling is used, the sampled values are still read into a worktable and sorted,, but since the sampled set of values is considerably smaller, the process takes much less time.
![Page 6: Sybase Update Statistics](https://reader031.vdocuments.us/reader031/viewer/2022013118/54667d55b4af9f91518b4cb3/html5/thumbnails/6.jpg)
Updating partition statisticsThis command generates distribution information for a particular partition in a table.
Syntaxupdate all statistics table_name [ partition data_partition_name ]
Sybase Update Statistics
![Page 7: Sybase Update Statistics](https://reader031.vdocuments.us/reader031/viewer/2022013118/54667d55b4af9f91518b4cb3/html5/thumbnails/7.jpg)
update table statisticsupdates statistics that are stored in systabstats table, such as rowcount, cluster ratios, and so on. update table statistics does not affect column statistics stored in sysstatistics.
Syntaxupdate table statistics table_name [ partition data_partition_name ]
Sybase Update Statistics
![Page 8: Sybase Update Statistics](https://reader031.vdocuments.us/reader031/viewer/2022013118/54667d55b4af9f91518b4cb3/html5/thumbnails/8.jpg)
update all statisticsUpdates statistics on all columns of the specified table.Again, sampling if specified is used to gather statistics for all non-leading columns of the index.
Syntaxupdate all statistics table_name [ partition data_partition_name ]
Sybase Update Statistics