fix(billing): 优化对账接口查询性能 - #1332
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
GET /api/admin/v1/billing/reconciliation会针对每个账户分别聚合账本流水和未完成交易;其中未完成交易缺少按账户和时间排序的专用索引,数据量增长后会产生大量重复扫描。改动
(started_at, id)部分索引account_id INCLUDE (reserve)部分索引CREATE INDEX CONCURRENTLY降低上线建索引对计费写入的阻塞验证
migrate完成up → down → up验证go test ./...go vet ./...sqlc diff说明
sqlcschema -check在未改动的main(d658310d)上已因图片迁移生成漂移失败,本 PR 未混入对应的无关 schema/model 生成重排。