From the course: Advanced SQL for Query Tuning and Performance Optimization

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Collect statistics about data in tables

Collect statistics about data in tables

- [Instructor] Schemas hold the data structures we commonly think of when we think of databases, and these are things like tables, indexes, constraints, views and materialized views, but they also include statistics about the data in those tables. For example, we need statistics on the number of rows in a table and how much storage is used. We also need to know the frequency of values and the cardinality of columns. It's also important to understand the distribution of data or how is that data kind of spread out. Under a normal distribution, data values tend toward the middle or the mean of the range and fall equally off in both directions. But sometimes values can tend toward one end of the distribution more than the other. So here, for example, we have a distribution where there are more instances toward the larger values. We call this a negative skew, and here we have values tending toward the lower end of the range.…

Contents