重现步骤
反馈人 王凯
数据库:zhcxkj_center_bi
查询时间:14.4133
扫描行数:274104
发送行数:1
指纹SQL: SELECT count ( ? ) FROM ( SELECT DISTINCT tacrv2 . asin , tacrv2 . country_code , tacrv2 . analysis_asin , tacrv2 . analysis_country_code FROM ? tacrv2 WHERE tacrv2 . customer_id = ? AND tacrv2 . is_deleted = ? AND tacrv2 . status = ? ) table_count ;
真实SQL:SELECT count(0) FROM (SELECT DISTINCT tacrv2.asin, tacrv2.country_code, tacrv2.analysis_asin, tacrv2.analysis_country_code FROM t_amazon_competitors_relation_v2 tacrv2 WHERE tacrv2.customer_id = 1 AND tacrv2.is_deleted = 0 AND tacrv2.status = 1) table_count;
无人工修改
AISQL修改建议:SELECT COUNT(DISTINCT CONCAT(tacrv2.asin, |, tacrv2.country_code, |, tacrv2.analysis_asin, |, tacrv2.analysis_country_code))
FROM t_amazon_competitors_relation_v2 tacrv2
WHERE tacrv2.customer_id = 1
AND tacrv2.is_deleted = 0
AND tacrv2.status = 1;
explain表:







id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> None ALL None None None None 74 100 None
2 DERIVED tacrv2 None index uk_asin_analysis_asin_country_code_analysis_country_code_cusId uk_asin_analysis_asin_country_code_analysis_country_code_cusId 396 None 74198 0.1 Using where

额外建议:
索引建议:
取出表 【t_amazon_competitors_relation_v2】 where条件字段 【customer_id】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。

取出表 【t_amazon_competitors_relation_v2】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。

取出表 【t_amazon_competitors_relation_v2】 where条件字段 【status】 100000 条记录,重复的数据有:【96254】 条,没有必要为该字段创建索引。

→ 【t_amazon_competitors_relation_v2】 表,无需添加任何索引。


历史记录  
  1. 2025-08-18 11:02:27, 由 李乐同 创建。
  2. 2025-08-18 14:52:38, 由 关依林 指派给 李乐同。
    修改了 指派给,旧值为 "guanyilin",新值为 "liletong"。

    无意义的优化

  3. 2025-08-18 14:55:05, 由 李乐同 指派给 王凯。
    修改了 指派给,旧值为 "liletong",新值为 "wangkai"。
  4. 2025-08-18 15:50:14, 由 王凯 指派给 关依林。
    修改了 指派给,旧值为 "wangkai",新值为 "guanyilin"。

    测试性能有30% 提升

    创建复合索引:idx_status_isdeleted_customerid (字段顺序status、is_deleted 、customer_id  )

    SELECT COUNT(DISTINCT tacrv2.asin, tacrv2.country_code, tacrv2.analysis_asin, tacrv2.analysis_country_code) 

    FROM t_amazon_competitors_relation_v2 tacrv2 
    WHERE tacrv2.customer_id = 1 
      AND tacrv2.is_deleted = 0 
      AND tacrv2.status = 1;
  5. 2025-08-18 18:03:16, 由 关依林 指派给 覃光贤。
    修改了 指派给,旧值为 "guanyilin",新值为 "qinguangxian"。
  6. 2025-08-18 18:19:38, 由 覃光贤 指派给 关依林。
    修改了 指派给,旧值为 "qinguangxian",新值为 "guanyilin"。

    优化前1.2秒



    优化后0.954  ,没有多大提示意义



    早上出现性能问题需要14.4133秒是因为commonCPU高,现在低了之后已经不慢了,早上数据库CPU

  7. 2025-08-18 20:17:01, 由 关依林 指派给 王凯。
    修改了 指派给,旧值为 "guanyilin",新值为 "wangkai"。
  8. 2025-08-19 09:40:55, 由 王凯 解决,方案为 非BUG-纯属误判 。
    修改了 解决方案,旧值为 "",新值为 "feibug"。
    修改了 解决版本,旧值为 "",新值为 "trunk"。
    修改了 解决日期,旧值为 "",新值为 "2025-08-19 09:40:03"。
    修改了 指派给 ,旧值为 "wangkai",新值为 "liletong"。
    修改了 Bug状态 ,旧值为 "active",新值为 "resolved"。
    修改了 是否确认,旧值为 "0",新值为 "1"。
    修改了 解决者 ,旧值为 "",新值为 "wangkai"。
    实际1.2秒,受其它慢sql影响,照常优化,bug关闭
  9. 2025-08-19 09:41:45, 由 王凯 编辑。
    修改了 所属模块 ,旧值为 "0",新值为 "1842"。
    修改了 优先级 ,旧值为 "2",新值为 "3"。
    修改了 业务部门 ,旧值为 "0",新值为 "2"。
    修改了 开发责任人,旧值为 "",新值为 "closed"。
    修改了 测试责任人,旧值为 "",新值为 "closed"。
    修改了 解决时效 ,旧值为 "0",新值为 "22.63"。
    修改了 重现步骤 ,区别为:
    001- 反馈人 王凯
    001+ 反馈人 王凯 数据库:zhcxkj_center_bi 查询时间:14.4133 扫描行数:274104 发送行数:1 指纹SQL: SELECT count ( ? ) FROM ( SELECT DISTINCT tacrv2 . asin , tacrv2 . country_code , tacrv2 . analysis_asin , tacrv2 . analysis_country_code FROM ? tacrv2 WHERE tacrv2 . customer_id = ? AND tacrv2 . is_deleted = ? AND tacrv2 . status = ? ) table_count ; 真实SQL:SELECT count(0) FROM (SELECT DISTINCT tacrv2.asin, tacrv2.country_code, tacrv2.analysis_asin, tacrv2.analysis_country_code FROM t_amazon_competitors_relation_v2 tacrv2 WHERE tacrv2.customer_id = 1 AND tacrv2.is_deleted = 0 AND tacrv2.status = 1) table_count; 无人工修改 AISQL修改建议:SELECT COUNT(DISTINCT CONCAT(tacrv2.asin, |, tacrv2.country_code, |, tacrv2.analysis_asin, |, tacrv2.analysis_country_code)) FROM t_amazon_competitors_relation_v2 tacrv2 WHERE tacrv2.customer_id = 1 AND tacrv2.is_deleted = 0 AND tacrv2.status = 1; explain表:id
    002- 数据库:zhcxkj_center_bi
    002+ select_type
    003- 查询时间:14.4133
    003+ table
    004- 扫描行数:274104
    004+ partitions
    005- 发送行数:1
    005+ type
    006- 指纹SQL: SELECT count ( ? ) FROM ( SELECT DISTINCT tacrv2 . asin , tacrv2 . country_code , tacrv2 . analysis_asin , tacrv2 . analysis_country_code FROM ? tacrv2 WHERE tacrv2 . customer_id = ? AND tacrv2 . is_deleted = ? AND tacrv2 . status = ? ) table_count ;
    006+ possible_keys
    007- 真实SQL:SELECT count(0) FROM (SELECT DISTINCT tacrv2.asin, tacrv2.country_code, tacrv2.analysis_asin, tacrv2.analysis_country_code FROM t_amazon_competitors_relation_v2 tacrv2 WHERE tacrv2.customer_id = 1 AND tacrv2.is_deleted = 0 AND tacrv2.status = 1) table_count;
    007+ key
    008- 无人工修改
    008+ key_len
    009- AISQL修改建议:SELECT COUNT(DISTINCT CONCAT(tacrv2.asin, |, tacrv2.country_code, |, tacrv2.analysis_asin, |, tacrv2.analysis_country_code))
    009+ ref
    010- FROM t_amazon_competitors_relation_v2 tacrv2
    010+ rows
    011- WHERE tacrv2.customer_id = 1
    011+ filtered
    012- AND tacrv2.is_deleted = 0
    012+ Extra
    013- AND tacrv2.status = 1;
    013+ 1
    014- explain表:
    014+ PRIMARY
    015-
    015+ &lt;derived2&gt;
    016-
    016+ None
    017-
    017+ ALL
    018-
    018+ None
    019-
    019+ None
    020-
    020+ None
    021-
    021+ None
    022-
    022+ 74
    023-
    023+ 100
    024-
    024+ None
    025-
    025+ 2
    026- id
    026+ DERIVED
    027-
    027+ tacrv2
    028-
    028+ None
    029- select_type
    029+ index
    030-
    030+ uk_asin_analysis_asin_country_code_analysis_country_code_cusId
    031-
    031+ uk_asin_analysis_asin_country_code_analysis_country_code_cusId
    032- table
    032+ 396
    033-
    033+ None
    034-
    034+ 74198
    035- partitions
    035+ 0.1
    036-
    036+ Using where
    037-
    037+
    038- type
    038+ 额外建议: 索引建议: 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【customer_id】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【status】 100000 条记录,重复的数据有:【96254】 条,没有必要为该字段创建索引。→ 【t_amazon_competitors_relation_v2】 表,无需添加任何索引。
    039-
    040-
    041- possible_keys
    042-
    043-
    044- key
    045-
    046-
    047- key_len
    048-
    049-
    050- ref
    051-
    052-
    053- rows
    054-
    055-
    056- filtered
    057-
    058-
    059- Extra
    060-
    061-
    062-
    063-
    064-
    065-
    066- 1
    067-
    068-
    069- PRIMARY
    070-
    071-
    072- &lt;derived2&gt;
    073-
    074-
    075- None
    076-
    077-
    078- ALL
    079-
    080-
    081- None
    082-
    083-
    084- None
    085-
    086-
    087- None
    088-
    089-
    090- None
    091-
    092-
    093- 74
    094-
    095-
    096- 100
    097-
    098-
    099- None
    100-
    101-
    102-
    103-
    104- 2
    105-
    106-
    107- DERIVED
    108-
    109-
    110- tacrv2
    111-
    112-
    113- None
    114-
    115-
    116- index
    117-
    118-
    119- uk_asin_analysis_asin_country_code_analysis_country_code_cusId
    120-
    121-
    122- uk_asin_analysis_asin_country_code_analysis_country_code_cusId
    123-
    124-
    125- 396
    126-
    127-
    128- None
    129-
    130-
    131- 74198
    132-
    133-
    134- 0.1
    135-
    136-
    137- Using where
    138-
    139-
    140-
    141-
    142-
    143- 额外建议:
    144- 索引建议:
    145- 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【customer_id】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。
    146-
    147- 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。
    148-
    149- 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【status】 100000 条记录,重复的数据有:【96254】 条,没有必要为该字段创建索引。
    150-
    151- → 【t_amazon_competitors_relation_v2】 表,无需添加任何索引。
    152-
    153-
    001- 反馈人 王凯<br />
    001+ 反馈人 王凯<br /> 数据库:zhcxkj_center_bi<br /> 查询时间:14.4133<br /> 扫描行数:274104<br /> 发送行数:1<br /> 指纹SQL: SELECT count ( ? ) FROM ( SELECT DISTINCT tacrv2 . asin , tacrv2 . country_code , tacrv2 . analysis_asin , tacrv2 . analysis_country_code FROM ? tacrv2 WHERE tacrv2 . customer_id = ? AND tacrv2 . is_deleted = ? AND tacrv2 . status = ? ) table_count ;<br /> 真实SQL:SELECT count(0) FROM (SELECT DISTINCT tacrv2.asin, tacrv2.country_code, tacrv2.analysis_asin, tacrv2.analysis_country_code FROM t_amazon_competitors_relation_v2 tacrv2 WHERE tacrv2.customer_id = 1 AND tacrv2.is_deleted = 0 AND tacrv2.status = 1) table_count;<br /> 无人工修改<br /> AISQL修改建议:SELECT COUNT(DISTINCT CONCAT(tacrv2.asin, |, tacrv2.country_code, |, tacrv2.analysis_asin, |, tacrv2.analysis_country_code))<br /> FROM t_amazon_competitors_relation_v2 tacrv2<br /> WHERE tacrv2.customer_id = 1<br /> AND tacrv2.is_deleted = 0<br /> AND tacrv2.status = 1;<br /> explain表:<br /><br /><br /><br /><br /><br /><br /><br /><table><tbody><tr><th>id</th>
    002- 数据库:zhcxkj_center_bi<br />
    002+ <th>select_type</th>
    003- 查询时间:14.4133<br />
    003+ <th>table</th>
    004- 扫描行数:274104<br />
    004+ <th>partitions</th>
    005- 发送行数:1<br />
    005+ <th>type</th>
    006- 指纹SQL: SELECT count ( ? ) FROM ( SELECT DISTINCT tacrv2 . asin , tacrv2 . country_code , tacrv2 . analysis_asin , tacrv2 . analysis_country_code FROM ? tacrv2 WHERE tacrv2 . customer_id = ? AND tacrv2 . is_deleted = ? AND tacrv2 . status = ? ) table_count ;<br />
    006+ <th>possible_keys</th>
    007- 真实SQL:SELECT count(0) FROM (SELECT DISTINCT tacrv2.asin, tacrv2.country_code, tacrv2.analysis_asin, tacrv2.analysis_country_code FROM t_amazon_competitors_relation_v2 tacrv2 WHERE tacrv2.customer_id = 1 AND tacrv2.is_deleted = 0 AND tacrv2.status = 1) table_count;<br />
    007+ <th>key</th>
    008- 无人工修改<br />
    008+ <th>key_len</th>
    009- AISQL修改建议:SELECT COUNT(DISTINCT CONCAT(tacrv2.asin, |, tacrv2.country_code, |, tacrv2.analysis_asin, |, tacrv2.analysis_country_code))<br />
    009+ <th>ref</th>
    010- FROM t_amazon_competitors_relation_v2 tacrv2<br />
    010+ <th>rows</th>
    011- WHERE tacrv2.customer_id = 1<br />
    011+ <th>filtered</th>
    012- AND tacrv2.is_deleted = 0<br />
    012+ <th>Extra</th>
    013- AND tacrv2.status = 1;<br />
    013+ </tr></tbody><tbody><tr><td>1</td>
    014- explain表:<br />
    014+ <td>PRIMARY</td>
    015- <br />
    015+ <td>&lt;derived2&gt;</td>
    016- <br />
    016+ <td>None</td>
    017- <br />
    017+ <td>ALL</td>
    018- <br />
    018+ <td>None</td>
    019- <br />
    019+ <td>None</td>
    020- <br />
    020+ <td>None</td>
    021- <br />
    021+ <td>None</td>
    022- <table>
    022+ <td>74</td>
    023- <tbody>
    023+ <td>100</td>
    024- <tr>
    024+ <td>None</td>
    025- <th>
    025+ </tr><tr><td>2</td>
    026- id
    026+ <td>DERIVED</td>
    027- </th>
    027+ <td>tacrv2</td>
    028- <th>
    028+ <td>None</td>
    029- select_type
    029+ <td>index</td>
    030- </th>
    030+ <td>uk_asin_analysis_asin_country_code_analysis_country_code_cusId</td>
    031- <th>
    031+ <td>uk_asin_analysis_asin_country_code_analysis_country_code_cusId</td>
    032- table
    032+ <td>396</td>
    033- </th>
    033+ <td>None</td>
    034- <th>
    034+ <td>74198</td>
    035- partitions
    035+ <td>0.1</td>
    036- </th>
    036+ <td>Using where</td>
    037- <th>
    037+ </tr></tbody></table><br />
    038- type
    038+ 额外建议:<br /> 索引建议:<br /> 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【customer_id】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。<br /><br /> 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。<br /><br /> 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【status】 100000 条记录,重复的数据有:【96254】 条,没有必要为该字段创建索引。<br /><br /><span style="color:#008000;font-weight:bold;">→ 【t_amazon_competitors_relation_v2】 表,无需添加任何索引。</span><br /><br /><br />
    039- </th>
    040- <th>
    041- possible_keys
    042- </th>
    043- <th>
    044- key
    045- </th>
    046- <th>
    047- key_len
    048- </th>
    049- <th>
    050- ref
    051- </th>
    052- <th>
    053- rows
    054- </th>
    055- <th>
    056- filtered
    057- </th>
    058- <th>
    059- Extra
    060- </th>
    061- </tr>
    062- </tbody>
    063- <tbody>
    064- <tr>
    065- <td>
    066- 1
    067- </td>
    068- <td>
    069- PRIMARY
    070- </td>
    071- <td>
    072- &lt;derived2&gt;
    073- </td>
    074- <td>
    075- None
    076- </td>
    077- <td>
    078- ALL
    079- </td>
    080- <td>
    081- None
    082- </td>
    083- <td>
    084- None
    085- </td>
    086- <td>
    087- None
    088- </td>
    089- <td>
    090- None
    091- </td>
    092- <td>
    093- 74
    094- </td>
    095- <td>
    096- 100
    097- </td>
    098- <td>
    099- None
    100- </td>
    101- </tr>
    102- <tr>
    103- <td>
    104- 2
    105- </td>
    106- <td>
    107- DERIVED
    108- </td>
    109- <td>
    110- tacrv2
    111- </td>
    112- <td>
    113- None
    114- </td>
    115- <td>
    116- index
    117- </td>
    118- <td>
    119- uk_asin_analysis_asin_country_code_analysis_country_code_cusId
    120- </td>
    121- <td>
    122- uk_asin_analysis_asin_country_code_analysis_country_code_cusId
    123- </td>
    124- <td>
    125- 396
    126- </td>
    127- <td>
    128- None
    129- </td>
    130- <td>
    131- 74198
    132- </td>
    133- <td>
    134- 0.1
    135- </td>
    136- <td>
    137- Using where
    138- </td>
    139- </tr>
    140- </tbody>
    141- </table>
    142- <br />
    143- 额外建议:<br />
    144- 索引建议:<br />
    145- 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【customer_id】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。<br />
    146- <br />
    147- 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。<br />
    148- <br />
    149- 取出表 【t_amazon_competitors_relation_v2】 where条件字段 【status】 100000 条记录,重复的数据有:【96254】 条,没有必要为该字段创建索引。<br />
    150- <br />
    151- <span style="color:green;font-weight:bold;">→ 【t_amazon_competitors_relation_v2】 表,无需添加任何索引。</span><br />
    152- <br />
    153- <br />
  10. 2025-08-19 09:41:49, 由 王凯 关闭。
    修改了 Bug状态 ,旧值为 "resolved",新值为 "closed"。
    修改了 指派给 ,旧值为 "liletong",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "wangkai"。
    修改了 关闭日期,旧值为 "",新值为 "2025-08-19 09:41:49"。
  11. 2025-08-21 09:16:06, 由 陈莉珍 编辑。
    修改了 所属项目,旧值为 "51",新值为 "52"。
    修改了 所属模块,旧值为 "1842",新值为 "1832"。
所属项目 智能中心-需求池
所属模块 虎鲸系统(有品)
所属计划
所属迭代
Bug类型
严重程度 一般
优先级 P3
Bug状态 已关闭
业务部门 总经办
影响功能
开发责任人 Closed
测试责任人 Closed
解决时效 22.63
激活次数 0
激活日期
是否确认 是
当前指派 Closed 于 2025-08-21 09:16:06
截止日期 0000-00-00
上线时间 2025-08-19 21:00:00
上线时效 33.96
操作系统
浏览器
关键词
抄送给
所属迭代
相关需求
相关任务
由谁创建 李乐同 于 2025-08-18 11:02:27
影响环境 生产环境-业务反馈
由谁解决 王凯 于 2025-08-19 09:40:03
解决版本 主干
解决方案 非BUG-纯属误判
由谁关闭 王凯 于 2025-08-19 09:41:49
最后修改 陈莉珍 于 2025-08-21 09:16:06
相关Bug