User Guide > Performance Tuning > Creating Cardinality Statistics for Cost-Based Optimization > Refreshing Cardinality Statistics
 
Refreshing Cardinality Statistics
You can schedule statistics gathering and refreshing for a time that is best for you. You can use the following procedure, or refer to the steps in Using TDV API Procedures to Refresh or Cancel Resource Statistics.
To refresh cardinality statistics
1. Follow the instruction in Creating Cardinality Statistics for a View or Creating Cardinality Statistics on a Data Source.
2. Set the statistics gathering schedules for one of the following:
Manual—Use Gather Now to begin collecting statistics immediately. If your cache is controlled by a cache policy, use a periodic or programmatic refresh.
Exactly Once—Requires that you set a day and time in the future to run.
Periodic—Statistics collection occurs at timed intervals, such as at an off-peak hour each night.
Frequency of statistics gathering also depends on data volatility. Some tables never change and others change frequently. Gather statistics based on the expected frequency of changes to cardinality or table boundaries.
It is best to use off-peak hours for gathering data source statistics and to use multiple threads for data sources that support them.
3. Use the Stats Gathering Timeout field to specify the number of minutes permitted for gathering data from a resource.
A value of 0 (zero; the default) indicates that there is no time limit.
If the timeout expires but statistics processing is already returning data, the timeout triggers an attempt to make statistical estimates from the subset of data already returned.
4. Save your selections.