From 37d358cd5225eb6a5ec3cfd25918db3654fe63de Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 25 Mar 2025 00:12:51 +0800 Subject: [PATCH] :art: Add index `idx_attributes_block_id` https://ld246.com/article/1742827508465 --- kernel/sql/database.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/sql/database.go b/kernel/sql/database.go index 74e82b925..3325366db 100644 --- a/kernel/sql/database.go +++ b/kernel/sql/database.go @@ -197,6 +197,10 @@ func initDBTables() { if err != nil { logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create table [attributes] failed: %s", err) } + _, err = db.Exec("CREATE INDEX idx_attributes_block_id ON attributes(block_id)") + if err != nil { + logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create index [idx_attributes_block_id] failed: %s", err) + } _, err = db.Exec("CREATE INDEX idx_attributes_root_id ON attributes(root_id)") if err != nil { logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create index [idx_attributes_root_id] failed: %s", err)