补充财务查询索引和慢 SQL 日志
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
-- 为后台财务汇总、明细查询和退款统计补充复合索引。
|
||||
-- 该迁移按版本只执行一次;若手工执行,请先确认索引不存在。
|
||||
|
||||
ALTER TABLE rental_orders
|
||||
ADD INDEX idx_rental_orders_settled_at_id (settled_at, id);
|
||||
|
||||
ALTER TABLE rental_orders
|
||||
ADD INDEX idx_rental_orders_created_at_id (created_at, id);
|
||||
|
||||
ALTER TABLE order_checkouts
|
||||
ADD INDEX idx_order_checkouts_status_order_id_id (status, order_id, id);
|
||||
|
||||
ALTER TABLE payment_orders
|
||||
ADD INDEX idx_payment_orders_order_biz_status (order_id, biz_type, status);
|
||||
|
||||
ALTER TABLE payment_orders
|
||||
ADD INDEX idx_payment_orders_created_biz_status (created_at, biz_type, status);
|
||||
|
||||
ALTER TABLE wallet_ledger
|
||||
ADD INDEX idx_wallet_ledger_order_direction_biz (order_id, direction, biz_type);
|
||||
Reference in New Issue
Block a user