【 使用环境 】生产环境
【 OB or 其他组件 】
【 使用版本 】4.2.2
【问题描述】
select
*
from
mac_ocr_history
where
res_raw_data ->> '$.errorCode' = 0
and create_time >= '2023-10-01 00:00:00'
limit
200, 10
where中带有json字段的条件查询速度就会特别慢,这条sql执行时间6秒,去掉res_raw_data ->> '$.errorCode' = 0
查询时间0.003秒
【附件及日志】推荐使用OceanBase敏捷诊断工具obdiag收集诊断信息,详情参见链接(右键跳转查看):
nhii_ocean:nhii:mp_user,OB_MYSQL,mac_ocr_history,mac_ocr_history,OB_MYSQL_COM_QUERY,SELECT,success,,select%0A *%0Afrom%0A mac_ocr_history%0Awhere%0A res_raw_data ->> '$.errorCode' = 0%0A and create_time >= '2023-10-01 00:00:00'%0Alimit%0A 200%2C 10,6708605us,21us,0us,6296647us,Y0-00007FBC2B39FC20,YB42C0A80370-0006100B867EDA23-0-0,,,0,192.168.3.112:2881
2024-02-04 10:21:29.601105,undefined,,,,nhii_ocean:nhii:information_schema,OB_MYSQL,PROFILING,profiling,OB_MYSQL_COM_QUERY,SELECT,failed,1109,SELECT QUERY_ID%2C SUM(DURATION) AS SUM_DURATION FROM INFORMATION_SCHEMA.PROFILING GROUP BY QUERY_ID,1637us,1412us,0us,192us,Y0-00007FBC2B39FC20,YB42C0A80370-0006100B867EDA29-0-0,,,0,192.168.3.112:2881