mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #5359] [MERGED] perf(db): add an index on settings.key #5854
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5854
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5359
Author: @n0ctal
Created: 6/15/2026
Status: ✅ Merged
Merged: 6/20/2026
Merged by: @Mahyardana
Base:
main← Head:pr-0011-settings-key-index📝 Commits (1)
8f3ab97perf(db): add an index on settings.key📊 Changes
2 files changed (+31 additions, -1 deletions)
View changed files
📝
internal/database/model/model.go(+1 -1)➕
internal/database/settings_index_test.go(+30 -0)📄 Description
Summary
Adds a database index on
settings.keyso the hottest config lookup no longer full-scans the table.Why
getSetting(WHERE key = ?) runs on nearly every subscription request and job tick.settings.keyhad no index, so each lookup full-scans thesettingstable — including past the largexrayTemplateConfigblob.Scope
idx_settings_keyonsettings.keyAutoMigratecreates it on existing databases on upgradeValidation
HasIndexunit test afterAutoMigratedatabasepackage tests passRisk
Low. Index-only addition, no schema or behavior change, idempotent migration.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.