【详述】
类似下面的sql,内层sql直接执行很快,加上外层的where条件后,看执行计划外层过滤也下推到了内层,查询变慢很多,如何先执行内层查询再过滤数据
select
*
from
(
select
distinct if(
event_code = ‘success’,
cast(
json_extract_scalar(message_content, ‘$.member_id’) as bigint
),
member_id
) as member_id,
from
table
where
其他条件
)
where
member_id is not null
and member_id <> 0