选择率,基数计算公式

单个谓词过滤:

=  基数计算公式 :1/num_distinct*(num_rows-num_nulls),如果有直方图,基数计算公式=(num_rows-num_nulls)*density

>  基数计算公式:(high_value-limit)/(high_value-low_value)*(num_rows-num_nulls)

>=基数计算公式:((high_value-limit)/(high_value-low_value)+1/num_distinct)*(num_rows-num_nulls)     因为有=,所以要加上=的选择率,=的选择率为1/num_distinct

<  基数计算公式:(limit-low_value)/(high_value-low_value)*(num_rows-num_nulls)

<=基数计算公式:((limit-low_value)/(high_value-low_value)+1/num_distinct)*(num_rows-num_nulls)

between ... and .... 的基数计算公式等价于 xxx<= high_limit ,xxxx>=low_limit

    基数计算公式:((high_limit-low_limit)/(high_value-low_value)+2/num_distinct)*(num_rows-num_nulls)

low_limit<   and < high_limit 基数计算公式:(high_limit-low_limit)/(high_value-low_value)*(num_rows-num_nulls)

low_limit<= and <high_limit 基数计算公式:(high_limit-low_limit)/(high_value-low_value)+1/num_distinct)*(num_rows-num_nulls)

双谓词,多谓词

A AND B 选择率计算公式=A选择率*B选择率

A OR B   选择率计算公式=A+B-A AND B

NOT A 选择率计算公式= 1- A选择率

-------先到这里,以后继续更新---------

你可能感兴趣的:(选择率,基数计算公式)