我们有一张表BOOKS,两个列hotel_id,rate_category,我们来看一下这两列的数据分布:
SQL> select hotel_id,rate_category,count(1) from books
2 group by hotel_id,rate_category
3 order by hotel_id;
如果我们要找到表中满足条件20号酒店价格等级是21的记录,执行计划会是什么样子呢?
SQL> set autotrace trace exp
SQL> select hotel_id,rate_category from books where hotel_id=20 and rate_category=21;
Execution Plan
----------------------------------------------------------
Plan hash value: 2688610195