Adaptive Server 15.7 SP100 extends the support of hash-based statistics gathering to the create index command.
The create index command hash-based statistics gathering options allow minor index attributes to be gathered while the index is being created serially or in parallel. With hash-based statistics gathering enabled, it is not necessary to update statistics after creating the index in regards to minor index attributes.
create [unique] [clustered | nonclustered] index index_name
on database.]owner.]table_name
[with {...
[, statistics {no_hashing | new_hashing | hashing}]
[, statistics max_resource_granularity = int]
[, statistics histogram_tuning_factor =int]
[, statistics print_progress = int] } ]
...}
Use with statistics hashing to indicate that an index is to be created, and minor index attributes are to be gathered using hash-based statistics. Use with statistics no_hashing to indicate that no hash-based statistics are to be gathered. Index-leading column statistics that are gathered using sort-based algorithm from versions of Adaptive Server versions earlier than 15.7 ESD #2 are not impacted by the with statistics hashing options.
A new sp_configure option, utility statistics hashing is introduced in Adaptive Server 15.7 SP100. For option settings, see sp_configure in the System Changes > Procedures > Changed System Procedures section.
If the clauses no_hashing, new_hashing, or hashing have not been specified in the create index command, the value of utility statistics hashing is used.
Any explicit phrases used in create index with statistics histogram_tuning_factor take precedence over the sp_configure histogram_tuning_factor.
Any explicit phrases used in create index with statistics max_resource_granularity take precedence over the sp_configure max_resource_granularity.
Example 1
create unique clustered index au_id_ind
on authors(au_id, title_id)
with statistics hashing,
statistics using 50 values,
statistics print_progress = 1
Example 2
create index ind1
on titleauthor (au_id, title_id)
with statistics using 50 values,
statistics hashing,
statistics max_resource_granularity = 80
Example 3
create nonclustered index zip_ind
on authors(postalcode, au_id)
with fillfactor = 25,
consumers = 4,
statistics using 50 values,
statistics hashing,
statistics histogram_tuning_factor = 40
Example 4
create unique clustered index au_id_ind
on authors(au_id, title_id)
with statistics new_hashing