Skip to content

Commit 250b263

Browse files
committed
[O2B-1539] Add index on QC flags to help GAQ summary computation
Add a composite index on quality_control_flags(run_number, detector_id) that proved to reduce computation time for GAQ summary by 50% on local.
1 parent cb698d6 commit 250b263

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
3+
/** @type {import('sequelize-cli').Migration} */
4+
module.exports = {
5+
up: async (queryInterface) => queryInterface.sequelize.transaction(async (transaction) => {
6+
await queryInterface.addIndex('quality_control_flags', {
7+
name: 'quality_control_flags_run_detector_idx',
8+
fields: ['run_number', 'detector_id'],
9+
}, { transaction });
10+
}),
11+
12+
down: async (queryInterface) => queryInterface.sequelize.transaction(async (transaction) => {
13+
await queryInterface.removeIndex('quality_control_flags', 'quality_control_flags_run_detector_idx', { transaction });
14+
}),
15+
};

0 commit comments

Comments
 (0)