【 TiDB 使用环境】生产 【 TiDB 版本】 v5.1.1 【遇到的问题】 根据索引字段执行update语句偶尔很慢 【复现路径】
做过哪些操作出现的问题`
【问题现象及影响】
正常耗时的执行计划:
超时的执行计划:
表结构因为敏感,只上传部分
PRIMARY KEY (PFlowId
) /*T![clustered_index] CLUSTERED */,
UNIQUE KEY ix_channeltype_uniqueid
(ChannelType
,UniqueId
),
KEY ix_DataChange_LastTime
(datachange_lasttime
),
KEY ix_ProviderId
(ProviderId
),
KEY ix_BusinessDodumentId
(BusinessDocumentId
),
KEY ix_paymentflowid
(PaymentFlowId
),
KEY ix_billid
(BillId
),
KEY ix_jobid
(JobId
),
KEY idx_datachange_createtime
(datachange_createtime
),
KEY idx_OuterDocumentId
(OuterDocumentId
),
KEY ix_settlementItemType
(SettlementItemType
),
KEY ix_PurchaseOrderId
(PurchaseOrderId
),
KEY ix_PFlowStatus
(PFlowStatus
),
KEY ix_SettlementCategory
(SettlementCategory
),
KEY ix_currency
(Currency
),
KEY ix_splitId
(splitId
),
KEY ix_subTradeNo
(subTradeNo
),
KEY ix_payableorderId
(PayableorderId
),
KEY ix_settlementBatchId
(SettlementBatchId
)
满足条件的行数大约3万行左右:
select count(1) from Tistm_paymentflow where BillId
= 1100292925;
±---------+
| count(1) |
±---------+
| 27825 |
±---------+