perf(server): Optimize db indexes of chart tables
This commit is contained in:
parent
d3b4b70bfc
commit
2365761ba5
3 changed files with 175 additions and 5 deletions
|
@ -201,11 +201,12 @@ export default abstract class Chart<T extends Record<string, any>> {
|
|||
...Chart.convertSchemaToFlatColumnDefinitions(schema)
|
||||
},
|
||||
indices: [{
|
||||
columns: ['date']
|
||||
}, {
|
||||
columns: ['group']
|
||||
}, {
|
||||
columns: ['date', 'group']
|
||||
columns: ['date', 'group'],
|
||||
unique: true,
|
||||
}, { // groupにnullが含まれると↑のuniqeuは機能しないので↓の部分インデックスでカバー
|
||||
columns: ['date'],
|
||||
unique: true,
|
||||
where: '"group" IS NULL'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue