Comp 305-001/488-305: Database Administration
Spring 2017: Tuesdays, 4:15-6:45, Comm 010
Homework 3: DellStore and query optimization
Homework 3 #4: how does Postgres know about the selectivity of the clause
where products.price >= X
given that the histogram_bounds entry is null?
Here's the full response to this query (with \x in effect)
select * from pg_stats where
tablename='products' and attname='price';
So, while histogram_bounds is null, there's lots of comparable data in most_common_vals and most_common_freqs.
The most_common_vals entry
lists 21 prices, and, from this query
select count(distinct price) from products;
we see that there are only 21 distinct prices, so Postgres has listed them all.
select array_length(most_common_vals, 1)
from pg_stats where tablename = 'products' and attname = 'price';
NoSQL and CAP