feat: add timestamp index in monitorstatushistory24h table
This commit is contained in:
1 parent
9ad0c96d28
commit
fe7afd4063
5 files changed
+1336
-1
No files matched your search
@@ -0,0 +1 @@
|
||||
CREATE INDEX `monitor_status_history_24h_timestamp_idx` ON `monitor_status_history_24h` (`timestamp`);
|
||||
File diff suppressed because it is too large.
Load diff
@@ -22,6 +22,13 @@
|
||||
"when": 1750852918387,
|
||||
"tag": "0002_public_domino",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"version": "6",
|
||||
"when": 1751016667916,
|
||||
"tag": "0003_reflective_random",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -222,5 +222,9 @@ ALTER TABLE \`agents\` DROP COLUMN \`network_tx\`;`
|
||||
CREATE INDEX IF NOT EXISTS \`monitor_daily_stats_monitor_id_date_idx\` ON \`monitor_daily_stats\` (\`monitor_id\`,\`date\`);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX IF NOT EXISTS \`monitor_status_history_24h_monitor_timestamp_idx\` ON \`monitor_status_history_24h\` (\`monitor_id\`,\`timestamp\`);`
|
||||
},
|
||||
{
|
||||
name: "0003_reflective_random.sql",
|
||||
sql: `CREATE INDEX IF NOT EXISTS \`monitor_status_history_24h_timestamp_idx\` ON \`monitor_status_history_24h\` (\`timestamp\`);`
|
||||
}
|
||||
];
|
||||
@@ -42,7 +42,9 @@ export const monitorStatusHistory24h = sqliteTable("monitor_status_history_24h",
|
||||
error: text("error")
|
||||
}, (table) => ({
|
||||
// monitor_id 和 timestamp 的联合索引,用于优化按监控项和时间查询的性能
|
||||
monitorTimestampIdx: index("monitor_status_history_24h_monitor_timestamp_idx").on(table.monitor_id, table.timestamp)
|
||||
monitorTimestampIdx: index("monitor_status_history_24h_monitor_timestamp_idx").on(table.monitor_id, table.timestamp),
|
||||
// timestamp 单独索引,用于优化按时间排序和范围查询的性能
|
||||
timestampIdx: index("monitor_status_history_24h_timestamp_idx").on(table.timestamp)
|
||||
}));
|
||||
|
||||
// 监控每日统计表
|
||||
|
||||
Reference in new issue
Block a user