- 论坛徽章:
- 0
|
表xxx的两个索引
idx_3col 字段 email_status,birthdate,email
idx_5col 字段 email_status,city,gender,birthdate,interests_value
两个sql
这个总在用idx_3col
select count(*) from xxx where
email_status='N'
and (city is null or city is not null )
and ( gender is null or gender is not null )
and birthdate between add_months(sysdate,-35*12)
and add_months(sysdate,-25*12)
and ( floor(mod(interest_value/power(2, ,2))=1
or floor(mod(interest_value/power(2,12),2))=1 );
这个用的idx_5col
select count(*) from XXX where
email_status='N'
and city in ('51_hefei','51_beijing','51_chongqing','51_fuzhou')
and ( gender is null or gender is not null )
and birthdate between add_months(sysdate,-35*12)
and add_months(sysdate,-25*12)
and ( floor(mod(interest_value/power(2, ,2))=1
or floor(mod(interest_value/power(2,12),2))=1 )
我希望两个都用idx_5col,而且也应该是这样的。为什么会这样呢? |
|