cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between different update statistics commands in ASE

05-08-2017 7:49 PM
sladebe Active Participant
3442 views 1 comments
0 Likes
SAP Managed Tags
Subscribe

I'm trying to figure out the difference between these update statistics commands (with descriptions copy/pasted from the documentation. Bold added by me):

  • update statistics <table> - "Updates information about the distribution of key values in specified indexes, for all columns in an index, table, or partition"|
  • update index statistics <table> - "Updates the statistics for all columns in an index."
  • update all statistics <table> - "Updates all statistics information for a given table
    ..snip..., regardless of whether they are indexed"

Does 'update statistics <table>' update stats for all columns in a table? I think it *doesn't* because "update all statistics" says it does all columns. Maybe 'update statistics <table>' only updates leading index columns? Does it update non-indexed columns?

Does 'update index statistics <table>' update stats for all columns in all indexes in a table? (I think it *does*)

Thanks in advance
Ben

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

sladebe
Active Participant
0 Likes

So I ran a quick test and verified the following:

  • update statistics <table> - updates leading columns of indexes, and also updates statistics for "column groups" within the index. Ie, if your index has fields col1, col1, & col3 then "update statistics" will update statistics for col1, for col1 & col2, and for col1, col2, & col3
  • update statistics <table> <index> - is the same as "update statistics", but just for one index.
  • update index statistics <table> - does everything from "update statistics" plus update stats for individual columns in the index.
  • update all statistics <table> - updates stats for all columns (and index column groups as described above)

So, yes, your assumptions are true.

I guess my point is the documentation saying:

  • update statistics <table> - "Updates information about the distribution of key values in specified indexes, for all columns in an index, table, or...

Is just flat out misleading. I'll create an incident (FWIW).