You cannot actually apply USING SAMPLE to summary stats, which are the table-level statistics new in 14.0. I'm guessing you meant you were collecting sampled stats on a column or index of the table.
When you attach USING SAMPLE to a collect stats statement and then collect stats on that column, the resulting histogram will be treated the same was as if full stats had been collected. The sampling option only has an impact during the collection of statistics, and not how those stats are used. The optimizer will use the number of distinct values in the histogram to base its estimates on the row count that will come out of an aggregation process if sample or full stats have been collected on the GROUP BY column(s).
Whether or not sampled stats are as beneficial as collecting full stats in your case will depend on the degree of skew in the GROUP BY column. You could run an explain and look at the query plan row count estimate with sampled stats, then collect full stats and see if the estimate has changed very much.
Santanu,
You cannot actually apply USING SAMPLE to summary stats, which are the table-level statistics new in 14.0. I'm guessing you meant you were collecting sampled stats on a column or index of the table.
When you attach USING SAMPLE to a collect stats statement and then collect stats on that column, the resulting histogram will be treated the same was as if full stats had been collected. The sampling option only has an impact during the collection of statistics, and not how those stats are used. The optimizer will use the number of distinct values in the histogram to base its estimates on the row count that will come out of an aggregation process if sample or full stats have been collected on the GROUP BY column(s).
Whether or not sampled stats are as beneficial as collecting full stats in your case will depend on the degree of skew in the GROUP BY column. You could run an explain and look at the query plan row count estimate with sampled stats, then collect full stats and see if the estimate has changed very much.
Thanks, -Carrie