重现步骤
反馈人:袁慧斌
数据库:zhcxkj_center_strategy_comprehensive
查询时间:18.717
执行次数: 50
扫描行数:251120
发送行数:184.44
指纹SQL: SELECT id , promotion_id , promotion_name , promotion_type , source_id , source_name , site_id , offer_id , pf_listing_id , original_price , price , currency_id , STATUS , meli_percent , seller_percent , create_by , update_by , create_name , update_name , create_time , update_time , is_deleted , version FROM ? FORCE INDEX ( idx_source_site_promotion ) where source_id = ? and site_id = ? and promotion_id in ( ? , ? , ? ) and STATUS = ? and promotion_type = ? and is_deleted = ? limit ? ;
真实SQL:SELECT id, promotion_id, promotion_name, promotion_type, source_id, source_name, site_id, offer_id, pf_listing_id, original_price, price, currency_id, STATUS, meli_percent, seller_percent, create_by, update_by, create_name, update_name, create_time, update_time, is_deleted, version FROM t_promotion_candidate_detail_mercadolibre_2 FORCE INDEX(idx_source_site_promotion) where source_id = 29225 and site_id = MCO and promotion_id in ( P-MCO15205004 , P-MCO15383010 , P-MCO15385004 ) and STATUS = candidate and promotion_type = DEAL and is_deleted = 0 limit 200;
无人工修改
AISQL修改建议:SELECT id,
promotion_id,
promotion_name,
promotion_type,
source_id,
source_name,
site_id,
offer_id,
pf_listing_id,
original_price,
price,
currency_id,
STATUS,
meli_percent,
seller_percent,
create_by,
update_by,
create_name,
update_name,
create_time,
update_time,
is_deleted,
VERSION
FROM t_promotion_candidate_detail_mercadolibre_2
WHERE source_id = 29225
AND site_id = MCO
AND promotion_id IN (P-MCO15205004,P-MCO15383010,P-MCO15385004)
AND STATUS = candidate
AND promotion_type = DEAL
AND is_deleted = 0
ORDER BY id
LIMIT 200;


优化说明:
1. 移除了FORCE INDEX强制索引提示,让优化器自动选择最优索引
2. 添加了ORDER BY子句确保结果有序,避免无排序的LIMIT可能带来的性能问题
3. 将IN列表中的值紧凑排列,减少SQL文本大小
4. 查询条件已经非常具体,且使用了多个等值条件,索引选择性应该很好

如果现有索引idx_source_site_promotion包含(source_id, site_id, promotion_id)字段,则优化器会自动选择该索引。
explain表:






id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t_promotion_candidate_detail_mercadolibre_2 None range idx_source_site_promotion idx_source_site_promotion 1599 None 364912 10 Using index condition; Using where

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

取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【site_id = MCO】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。

取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【STATUS = candidate】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。

取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【promotion_type = DEAL】 100000 条记录,重复的数据有:【58323】 条,没有必要为该字段创建索引。

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

→ 【t_promotion_candidate_detail_mercadolibre_2】表 【promotion_id】字段,索引已经存在,无需添加任何索引。

【t_promotion_candidate_detail_mercadolibre_2】表 【promotion_id】字段,索引分析:
+--------------------------------+--------------------------------+---------------+---------------+
| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
+================================+================================+===============+===============+
| t_promotion_candidate_detail_m | idx_promotion_id_source_id_sit | promotion_id | 8949 |
| ercadolibre_2 | e_id_version_is_deleted | | |
+--------------------------------+--------------------------------+---------------+---------------+
| t_promotion_candidate_detail_m | idx_source_promotion_status | promotion_id | 17089 |
| ercadolibre_2 | | | |
+--------------------------------+--------------------------------+---------------+---------------+
| t_promotion_candidate_detail_m | idx_source_site_promotion | promotion_id | 17912 |
| ercadolibre_2 | | | |
+--------------------------------+--------------------------------+---------------+---------------+


历史记录  
  1. 2025-09-09 09:35:05, 由 李乐同 创建。
  2. 2025-09-09 14:12:01, 由 王金锋 解决,方案为 非BUG-纯属误判 。
    修改了 解决方案,旧值为 "",新值为 "feibug"。
    修改了 解决版本,旧值为 "",新值为 "trunk"。
    修改了 解决日期,旧值为 "",新值为 "2025-09-09 14:11:20"。
    修改了 指派给 ,旧值为 "wangjinfeng",新值为 "liletong"。
    修改了 Bug状态 ,旧值为 "active",新值为 "resolved"。
    修改了 是否确认,旧值为 "0",新值为 "1"。
    修改了 解决者 ,旧值为 "",新值为 "wangjinfeng"。

    这个问题同:https://pm.zhcxkj.com/zentao/bug-view-59150.html

    强制索引是你们上次提的工单要求加的

  3. 2025-09-09 14:13:29, 由 李乐同 编辑。
    修改了 所属模块 ,旧值为 "0",新值为 "1874"。
    修改了 业务部门 ,旧值为 "0",新值为 "2"。
    修改了 开发责任人,旧值为 "",新值为 "yuanhuibin"。
    修改了 测试责任人,旧值为 "",新值为 "yuanhuibin"。
    修改了 解决时效 ,旧值为 "0",新值为 "4.6"。
    修改了 重现步骤 ,区别为:
    001- 反馈人:袁慧斌
    001+ 反馈人:袁慧斌 数据库:zhcxkj_center_strategy_comprehensive 查询时间:18.717 执行次数: 50 扫描行数:251120 发送行数:184.44 指纹SQL: SELECT id , promotion_id , promotion_name , promotion_type , source_id , source_name , site_id , offer_id , pf_listing_id , original_price , price , currency_id , STATUS , meli_percent , seller_percent , create_by , update_by , create_name , update_name , create_time , update_time , is_deleted , version FROM ? FORCE INDEX ( idx_source_site_promotion ) where source_id = ? and site_id = ? and promotion_id in ( ? , ? , ? ) and STATUS = ? and promotion_type = ? and is_deleted = ? limit ? ; 真实SQL:SELECT id, promotion_id, promotion_name, promotion_type, source_id, source_name, site_id, offer_id, pf_listing_id, original_price, price, currency_id, STATUS, meli_percent, seller_percent, create_by, update_by, create_name, update_name, create_time, update_time, is_deleted, version FROM t_promotion_candidate_detail_mercadolibre_2 FORCE INDEX(idx_source_site_promotion) where source_id = 29225 and site_id = MCO and promotion_id in ( P-MCO15205004 , P-MCO15383010 , P-MCO15385004 ) and STATUS = candidate and promotion_type = DEAL and is_deleted = 0 limit 200; 无人工修改 AISQL修改建议:SELECT id, promotion_id, promotion_name, promotion_type, source_id, source_name, site_id, offer_id, pf_listing_id, original_price, price, currency_id, STATUS, meli_percent, seller_percent, create_by, update_by, create_name, update_name, create_time, update_time, is_deleted, VERSION FROM t_promotion_candidate_detail_mercadolibre_2 WHERE source_id = 29225 AND site_id = MCO AND promotion_id IN (P-MCO15205004,P-MCO15383010,P-MCO15385004) AND STATUS = candidate AND promotion_type = DEAL AND is_deleted = 0 ORDER BY id LIMIT 200; 优化说明: 1. 移除了FORCE INDEX强制索引提示,让优化器自动选择最优索引 2. 添加了ORDER BY子句确保结果有序,避免无排序的LIMIT可能带来的性能问题 3. 将IN列表中的值紧凑排列,减少SQL文本大小 4. 查询条件已经非常具体,且使用了多个等值条件,索引选择性应该很好 如果现有索引idx_source_site_promotion包含(source_id, site_id, promotion_id)字段,则优化器会自动选择该索引。 explain表:id
    002- 数据库:zhcxkj_center_strategy_comprehensive
    002+ select_type
    003- 查询时间:18.717
    003+ table
    004- 执行次数: 50
    004+ partitions
    005- 扫描行数:251120
    005+ type
    006- 发送行数:184.44
    006+ possible_keys
    007- 指纹SQL: SELECT id , promotion_id , promotion_name , promotion_type , source_id , source_name , site_id , offer_id , pf_listing_id , original_price , price , currency_id , STATUS , meli_percent , seller_percent , create_by , update_by , create_name , update_name , create_time , update_time , is_deleted , version FROM ? FORCE INDEX ( idx_source_site_promotion ) where source_id = ? and site_id = ? and promotion_id in ( ? , ? , ? ) and STATUS = ? and promotion_type = ? and is_deleted = ? limit ? ;
    007+ key
    008- 真实SQL:SELECT id, promotion_id, promotion_name, promotion_type, source_id, source_name, site_id, offer_id, pf_listing_id, original_price, price, currency_id, STATUS, meli_percent, seller_percent, create_by, update_by, create_name, update_name, create_time, update_time, is_deleted, version FROM t_promotion_candidate_detail_mercadolibre_2 FORCE INDEX(idx_source_site_promotion) where source_id = 29225 and site_id = MCO and promotion_id in ( P-MCO15205004 , P-MCO15383010 , P-MCO15385004 ) and STATUS = candidate and promotion_type = DEAL and is_deleted = 0 limit 200;
    008+ key_len
    009- 无人工修改
    009+ ref
    010- AISQL修改建议:SELECT id,
    010+ rows
    011- promotion_id,
    011+ filtered
    012- promotion_name,
    012+ Extra
    013- promotion_type,
    013+ 1
    014- source_id,
    014+ SIMPLE
    015- source_name,
    015+ t_promotion_candidate_detail_mercadolibre_2
    016- site_id,
    016+ None
    017- offer_id,
    017+ range
    018- pf_listing_id,
    018+ idx_source_site_promotion
    019- original_price,
    019+ idx_source_site_promotion
    020- price,
    020+ 1599
    021- currency_id,
    021+ None
    022- STATUS,
    022+ 364912
    023- meli_percent,
    023+ 10
    024- seller_percent,
    024+ Using index condition; Using where
    025- create_by,
    025+
    026- update_by,
    026+ 额外建议: 索引建议: 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【source_id = 29225】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【site_id = MCO】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【STATUS = candidate】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【promotion_type = DEAL】 100000 条记录,重复的数据有:【58323】 条,没有必要为该字段创建索引。 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【is_deleted = 0】 100000 条记录,重复的数据有:【88891】 条,没有必要为该字段创建索引。→ 【t_promotion_candidate_detail_mercadolibre_2】表 【promotion_id】字段,索引已经存在,无需添加任何索引。 【t_promotion_candidate_detail_mercadolibre_2】表 【promotion_id】字段,索引分析: +--------------------------------+--------------------------------+---------------+---------------+ | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY | +================================+================================+===============+===============+ | t_promotion_candidate_detail_m | idx_promotion_id_source_id_sit | promotion_id | 8949 | | ercadolibre_2 | e_id_version_is_deleted | | | +--------------------------------+--------------------------------+---------------+---------------+ | t_promotion_candidate_detail_m | idx_source_promotion_status | promotion_id | 17089 | | ercadolibre_2 | | | | +--------------------------------+--------------------------------+---------------+---------------+ | t_promotion_candidate_detail_m | idx_source_site_promotion | promotion_id | 17912 | | ercadolibre_2 | | | | +--------------------------------+--------------------------------+---------------+---------------+
    027- create_name,
    028- update_name,
    029- create_time,
    030- update_time,
    031- is_deleted,
    032- VERSION
    033- FROM t_promotion_candidate_detail_mercadolibre_2
    034- WHERE source_id = 29225
    035- AND site_id = MCO
    036- AND promotion_id IN (P-MCO15205004,P-MCO15383010,P-MCO15385004)
    037- AND STATUS = candidate
    038- AND promotion_type = DEAL
    039- AND is_deleted = 0
    040- ORDER BY id
    041- LIMIT 200;
    042-
    043-
    044- 优化说明:
    045- 1. 移除了FORCE INDEX强制索引提示,让优化器自动选择最优索引
    046- 2. 添加了ORDER BY子句确保结果有序,避免无排序的LIMIT可能带来的性能问题
    047- 3. 将IN列表中的值紧凑排列,减少SQL文本大小
    048- 4. 查询条件已经非常具体,且使用了多个等值条件,索引选择性应该很好
    049-
    050- 如果现有索引idx_source_site_promotion包含(source_id, site_id, promotion_id)字段,则优化器会自动选择该索引。
    051- explain表:
    052-
    053-
    054-
    055-
    056-
    057-
    058-
    059-
    060-
    061-
    062- id
    063-
    064-
    065- select_type
    066-
    067-
    068- table
    069-
    070-
    071- partitions
    072-
    073-
    074- type
    075-
    076-
    077- possible_keys
    078-
    079-
    080- key
    081-
    082-
    083- key_len
    084-
    085-
    086- ref
    087-
    088-
    089- rows
    090-
    091-
    092- filtered
    093-
    094-
    095- Extra
    096-
    097-
    098-
    099-
    100-
    101-
    102- 1
    103-
    104-
    105- SIMPLE
    106-
    107-
    108- t_promotion_candidate_detail_mercadolibre_2
    109-
    110-
    111- None
    112-
    113-
    114- range
    115-
    116-
    117- idx_source_site_promotion
    118-
    119-
    120- idx_source_site_promotion
    121-
    122-
    123- 1599
    124-
    125-
    126- None
    127-
    128-
    129- 364912
    130-
    131-
    132- 10
    133-
    134-
    135- Using index condition; Using where
    136-
    137-
    138-
    139-
    140-
    141- 额外建议:
    142- 索引建议:
    143- 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【source_id = 29225】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。
    144-
    145- 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【site_id = MCO】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。
    146-
    147- 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【STATUS = candidate】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。
    148-
    149- 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【promotion_type = DEAL】 100000 条记录,重复的数据有:【58323】 条,没有必要为该字段创建索引。
    150-
    151- 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【is_deleted = 0】 100000 条记录,重复的数据有:【88891】 条,没有必要为该字段创建索引。
    152-
    153- → 【t_promotion_candidate_detail_mercadolibre_2】表 【promotion_id】字段,索引已经存在,无需添加任何索引。
    154-
    155- 【t_promotion_candidate_detail_mercadolibre_2】表 【promotion_id】字段,索引分析:
    156- +--------------------------------+--------------------------------+---------------+---------------+
    157- | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
    158- +================================+================================+===============+===============+
    159- | t_promotion_candidate_detail_m | idx_promotion_id_source_id_sit | promotion_id | 8949 |
    160- | ercadolibre_2 | e_id_version_is_deleted | | |
    161- +--------------------------------+--------------------------------+---------------+---------------+
    162- | t_promotion_candidate_detail_m | idx_source_promotion_status | promotion_id | 17089 |
    163- | ercadolibre_2 | | | |
    164- +--------------------------------+--------------------------------+---------------+---------------+
    165- | t_promotion_candidate_detail_m | idx_source_site_promotion | promotion_id | 17912 |
    166- | ercadolibre_2 | | | |
    167- +--------------------------------+--------------------------------+---------------+---------------+
    168-
    169-
    001- 反馈人:袁慧斌<br />
    001+ 反馈人:袁慧斌<br /> 数据库:zhcxkj_center_strategy_comprehensive<br /> 查询时间:18.717<br /> 执行次数: 50<br /> 扫描行数:251120<br /> 发送行数:184.44<br /> 指纹SQL: SELECT id , promotion_id , promotion_name , promotion_type , source_id , source_name , site_id , offer_id , pf_listing_id , original_price , price , currency_id , STATUS , meli_percent , seller_percent , create_by , update_by , create_name , update_name , create_time , update_time , is_deleted , version FROM ? FORCE INDEX ( idx_source_site_promotion ) where source_id = ? and site_id = ? and promotion_id in ( ? , ? , ? ) and STATUS = ? and promotion_type = ? and is_deleted = ? limit ? ;<br /> 真实SQL:SELECT id, promotion_id, promotion_name, promotion_type, source_id, source_name, site_id, offer_id, pf_listing_id, original_price, price, currency_id, STATUS, meli_percent, seller_percent, create_by, update_by, create_name, update_name, create_time, update_time, is_deleted, version FROM t_promotion_candidate_detail_mercadolibre_2 FORCE INDEX(idx_source_site_promotion) where source_id = 29225 and site_id = MCO and promotion_id in ( P-MCO15205004 , P-MCO15383010 , P-MCO15385004 ) and STATUS = candidate and promotion_type = DEAL and is_deleted = 0 limit 200;<br /> 无人工修改<br /> AISQL修改建议:SELECT id,<br /> promotion_id,<br /> promotion_name,<br /> promotion_type,<br /> source_id,<br /> source_name,<br /> site_id,<br /> offer_id,<br /> pf_listing_id,<br /> original_price,<br /> price,<br /> currency_id,<br /> STATUS,<br /> meli_percent,<br /> seller_percent,<br /> create_by,<br /> update_by,<br /> create_name,<br /> update_name,<br /> create_time,<br /> update_time,<br /> is_deleted,<br /> VERSION<br /> FROM t_promotion_candidate_detail_mercadolibre_2<br /> WHERE source_id = 29225<br /> AND site_id = MCO<br /> AND promotion_id IN (P-MCO15205004,P-MCO15383010,P-MCO15385004)<br /> AND STATUS = candidate<br /> AND promotion_type = DEAL<br /> AND is_deleted = 0<br /> ORDER BY id<br /> LIMIT 200;<br /><br /><br /> 优化说明:<br /> 1. 移除了FORCE INDEX强制索引提示,让优化器自动选择最优索引<br /> 2. 添加了ORDER BY子句确保结果有序,避免无排序的LIMIT可能带来的性能问题<br /> 3. 将IN列表中的值紧凑排列,减少SQL文本大小<br /> 4. 查询条件已经非常具体,且使用了多个等值条件,索引选择性应该很好<br /><br /> 如果现有索引idx_source_site_promotion包含(source_id, site_id, promotion_id)字段,则优化器会自动选择该索引。<br /> explain表:<br /><br /><br /><br /><br /><br /><br /><table><tbody><tr><th>id</th>
    002- 数据库:zhcxkj_center_strategy_comprehensive<br />
    002+ <th>select_type</th>
    003- 查询时间:18.717<br />
    003+ <th>table</th>
    004- 执行次数: 50<br />
    004+ <th>partitions</th>
    005- 扫描行数:251120<br />
    005+ <th>type</th>
    006- 发送行数:184.44<br />
    006+ <th>possible_keys</th>
    007- 指纹SQL: SELECT id , promotion_id , promotion_name , promotion_type , source_id , source_name , site_id , offer_id , pf_listing_id , original_price , price , currency_id , STATUS , meli_percent , seller_percent , create_by , update_by , create_name , update_name , create_time , update_time , is_deleted , version FROM ? FORCE INDEX ( idx_source_site_promotion ) where source_id = ? and site_id = ? and promotion_id in ( ? , ? , ? ) and STATUS = ? and promotion_type = ? and is_deleted = ? limit ? ;<br />
    007+ <th>key</th>
    008- 真实SQL:SELECT id, promotion_id, promotion_name, promotion_type, source_id, source_name, site_id, offer_id, pf_listing_id, original_price, price, currency_id, STATUS, meli_percent, seller_percent, create_by, update_by, create_name, update_name, create_time, update_time, is_deleted, version FROM t_promotion_candidate_detail_mercadolibre_2 FORCE INDEX(idx_source_site_promotion) where source_id = 29225 and site_id = MCO and promotion_id in ( P-MCO15205004 , P-MCO15383010 , P-MCO15385004 ) and STATUS = candidate and promotion_type = DEAL and is_deleted = 0 limit 200;<br />
    008+ <th>key_len</th>
    009- 无人工修改<br />
    009+ <th>ref</th>
    010- AISQL修改建议:SELECT id,<br />
    010+ <th>rows</th>
    011- promotion_id,<br />
    011+ <th>filtered</th>
    012- promotion_name,<br />
    012+ <th>Extra</th>
    013- promotion_type,<br />
    013+ </tr></tbody><tbody><tr><td>1</td>
    014- source_id,<br />
    014+ <td>SIMPLE</td>
    015- source_name,<br />
    015+ <td>t_promotion_candidate_detail_mercadolibre_2</td>
    016- site_id,<br />
    016+ <td>None</td>
    017- offer_id,<br />
    017+ <td>range</td>
    018- pf_listing_id,<br />
    018+ <td>idx_source_site_promotion</td>
    019- original_price,<br />
    019+ <td>idx_source_site_promotion</td>
    020- price,<br />
    020+ <td>1599</td>
    021- currency_id,<br />
    021+ <td>None</td>
    022- STATUS,<br />
    022+ <td>364912</td>
    023- meli_percent,<br />
    023+ <td>10</td>
    024- seller_percent,<br />
    024+ <td>Using index condition; Using where</td>
    025- create_by,<br />
    025+ </tr></tbody></table><br />
    026- update_by,<br />
    026+ 额外建议:<br /> 索引建议:<br /> 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【source_id = 29225】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。<br /><br /> 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【site_id = MCO】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。<br /><br /> 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【STATUS = candidate】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。<br /><br /> 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【promotion_type = DEAL】 100000 条记录,重复的数据有:【58323】 条,没有必要为该字段创建索引。<br /><br /> 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【is_deleted = 0】 100000 条记录,重复的数据有:【88891】 条,没有必要为该字段创建索引。<br /><br /><span style="color:#008000;font-weight:bold;">→ 【t_promotion_candidate_detail_mercadolibre_2】表 【promotion_id】字段,索引已经存在,无需添加任何索引。</span><br /><br /> 【t_promotion_candidate_detail_mercadolibre_2】表 【promotion_id】字段,索引分析:<br /> +--------------------------------+--------------------------------+---------------+---------------+<br /> | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br /> +================================+================================+===============+===============+<br /> | t_promotion_candidate_detail_m | idx_promotion_id_source_id_sit | promotion_id | 8949 |<br /> | ercadolibre_2 | e_id_version_is_deleted | | |<br /> +--------------------------------+--------------------------------+---------------+---------------+<br /> | t_promotion_candidate_detail_m | idx_source_promotion_status | promotion_id | 17089 |<br /> | ercadolibre_2 | | | |<br /> +--------------------------------+--------------------------------+---------------+---------------+<br /> | t_promotion_candidate_detail_m | idx_source_site_promotion | promotion_id | 17912 |<br /> | ercadolibre_2 | | | |<br /> +--------------------------------+--------------------------------+---------------+---------------+<br /><br /><br />
    027- create_name,<br />
    028- update_name,<br />
    029- create_time,<br />
    030- update_time,<br />
    031- is_deleted,<br />
    032- VERSION<br />
    033- FROM t_promotion_candidate_detail_mercadolibre_2<br />
    034- WHERE source_id = 29225<br />
    035- AND site_id = MCO<br />
    036- AND promotion_id IN (P-MCO15205004,P-MCO15383010,P-MCO15385004)<br />
    037- AND STATUS = candidate<br />
    038- AND promotion_type = DEAL<br />
    039- AND is_deleted = 0<br />
    040- ORDER BY id<br />
    041- LIMIT 200;<br />
    042- <br />
    043- <br />
    044- 优化说明:<br />
    045- 1. 移除了FORCE INDEX强制索引提示,让优化器自动选择最优索引<br />
    046- 2. 添加了ORDER BY子句确保结果有序,避免无排序的LIMIT可能带来的性能问题<br />
    047- 3. 将IN列表中的值紧凑排列,减少SQL文本大小<br />
    048- 4. 查询条件已经非常具体,且使用了多个等值条件,索引选择性应该很好<br />
    049- <br />
    050- 如果现有索引idx_source_site_promotion包含(source_id, site_id, promotion_id)字段,则优化器会自动选择该索引。<br />
    051- explain表:<br />
    052- <br />
    053- <br />
    054- <br />
    055- <br />
    056- <br />
    057- <br />
    058- <table>
    059- <tbody>
    060- <tr>
    061- <th>
    062- id
    063- </th>
    064- <th>
    065- select_type
    066- </th>
    067- <th>
    068- table
    069- </th>
    070- <th>
    071- partitions
    072- </th>
    073- <th>
    074- type
    075- </th>
    076- <th>
    077- possible_keys
    078- </th>
    079- <th>
    080- key
    081- </th>
    082- <th>
    083- key_len
    084- </th>
    085- <th>
    086- ref
    087- </th>
    088- <th>
    089- rows
    090- </th>
    091- <th>
    092- filtered
    093- </th>
    094- <th>
    095- Extra
    096- </th>
    097- </tr>
    098- </tbody>
    099- <tbody>
    100- <tr>
    101- <td>
    102- 1
    103- </td>
    104- <td>
    105- SIMPLE
    106- </td>
    107- <td>
    108- t_promotion_candidate_detail_mercadolibre_2
    109- </td>
    110- <td>
    111- None
    112- </td>
    113- <td>
    114- range
    115- </td>
    116- <td>
    117- idx_source_site_promotion
    118- </td>
    119- <td>
    120- idx_source_site_promotion
    121- </td>
    122- <td>
    123- 1599
    124- </td>
    125- <td>
    126- None
    127- </td>
    128- <td>
    129- 364912
    130- </td>
    131- <td>
    132- 10
    133- </td>
    134- <td>
    135- Using index condition; Using where
    136- </td>
    137- </tr>
    138- </tbody>
    139- </table>
    140- <br />
    141- 额外建议:<br />
    142- 索引建议:<br />
    143- 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【source_id = 29225】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。<br />
    144- <br />
    145- 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【site_id = MCO】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。<br />
    146- <br />
    147- 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【STATUS = candidate】 100000 条记录,重复的数据有:【100000】 条,没有必要为该字段创建索引。<br />
    148- <br />
    149- 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【promotion_type = DEAL】 100000 条记录,重复的数据有:【58323】 条,没有必要为该字段创建索引。<br />
    150- <br />
    151- 取出表 【t_promotion_candidate_detail_mercadolibre_2】 where条件表达式 【is_deleted = 0】 100000 条记录,重复的数据有:【88891】 条,没有必要为该字段创建索引。<br />
    152- <br />
    153- <span style="color:green;font-weight:bold;">→ 【t_promotion_candidate_detail_mercadolibre_2】表 【promotion_id】字段,索引已经存在,无需添加任何索引。</span><br />
    154- <br />
    155- 【t_promotion_candidate_detail_mercadolibre_2】表 【promotion_id】字段,索引分析:<br />
    156- +--------------------------------+--------------------------------+---------------+---------------+<br />
    157- | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />
    158- +================================+================================+===============+===============+<br />
    159- | t_promotion_candidate_detail_m | idx_promotion_id_source_id_sit | promotion_id | 8949 |<br />
    160- | ercadolibre_2 | e_id_version_is_deleted | | |<br />
    161- +--------------------------------+--------------------------------+---------------+---------------+<br />
    162- | t_promotion_candidate_detail_m | idx_source_promotion_status | promotion_id | 17089 |<br />
    163- | ercadolibre_2 | | | |<br />
    164- +--------------------------------+--------------------------------+---------------+---------------+<br />
    165- | t_promotion_candidate_detail_m | idx_source_site_promotion | promotion_id | 17912 |<br />
    166- | ercadolibre_2 | | | |<br />
    167- +--------------------------------+--------------------------------+---------------+---------------+<br />
    168- <br />
    169- <br />
  4. 2025-09-09 14:13:50, 由 李乐同 编辑。
    修改了 上线时间,旧值为 "0000-00-00 00:00:00",新值为 "2025-09-09 14:10"。
    修改了 上线时效,旧值为 "-1",新值为 "4.58"。
  5. 2025-09-09 14:13:53, 由 李乐同 关闭。
    修改了 Bug状态 ,旧值为 "resolved",新值为 "closed"。
    修改了 指派给 ,旧值为 "liletong",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "liletong"。
    修改了 关闭日期,旧值为 "",新值为 "2025-09-09 14:13:53"。
所属项目 技术中心-需求池
所属模块 多平台   mercado
所属计划
所属迭代
Bug类型
严重程度 一般
优先级 P2
Bug状态 已关闭
业务部门 总经办
影响功能
开发责任人 袁慧斌
测试责任人 袁慧斌
解决时效 4.6
激活次数 0
激活日期
是否确认 是
当前指派 Closed 于 2025-09-09 14:13:53
截止日期 0000-00-00
上线时间 2025-09-09 14:10:00
上线时效 4.58
操作系统
浏览器
关键词
抄送给
所属迭代
相关需求
相关任务
由谁创建 李乐同 于 2025-09-09 09:35:05
影响环境 生产环境-业务反馈
由谁解决 王金锋 于 2025-09-09 14:11:20
解决版本 主干
解决方案 非BUG-纯属误判
由谁关闭 李乐同 于 2025-09-09 14:13:53
最后修改 李乐同 于 2025-09-09 14:13:53
相关Bug