实现资产双向换货链路查询
This commit is contained in:
3
migrations/000161_add_exchange_trace_indexes.down.sql
Normal file
3
migrations/000161_add_exchange_trace_indexes.down.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
-- 回滚换货链双向查询索引,不修改换货单业务数据。
|
||||
DROP INDEX IF EXISTS idx_exchange_trace_old_asset;
|
||||
DROP INDEX IF EXISTS idx_exchange_trace_new_asset;
|
||||
8
migrations/000161_add_exchange_trace_indexes.up.sql
Normal file
8
migrations/000161_add_exchange_trace_indexes.up.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
-- 为已完成且未软删除的换货链双向最新记录查询增加非唯一部分索引。
|
||||
CREATE INDEX idx_exchange_trace_new_asset
|
||||
ON tb_exchange_order USING btree (new_asset_type, new_asset_id, completed_at DESC NULLS LAST, id DESC)
|
||||
WHERE status = 4 AND deleted_at IS NULL;
|
||||
|
||||
CREATE INDEX idx_exchange_trace_old_asset
|
||||
ON tb_exchange_order USING btree (old_asset_type, old_asset_id, completed_at DESC NULLS LAST, id DESC)
|
||||
WHERE status = 4 AND deleted_at IS NULL;
|
||||
Reference in New Issue
Block a user