-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate stats columns from show to show_stats (#1228)
* Migrate stats columns from show to show_stats Frequently changing columns on the SHOW table were causing the show indexes to bloat faster than desired and impacting the system performance, specially in the Whiteboard queries for jobs. * Fix merge issues Add gpu columns * Version bump * Update cuebot/src/main/java/com/imageworks/spcue/dao/postgres/WhiteboardDaoJdbc.java Signed-off-by: Diego Tavares da Silva <dtavares@imageworks.com> * Creating a new show should also create a show_stats entry A show_stats row needs to be created and deleted together with a show row. This bug was introduced on https://gitlab.spimageworks.com/spi/dev/infrastructure/api/opencue/-/merge_requests/427 * Rename V21__AddShowStats.sql to V16__AddShowStats.sql --------- Signed-off-by: Diego Tavares da Silva <dtavares@imageworks.com>
- Loading branch information
1 parent
0199fb2
commit d2057d3
Showing
7 changed files
with
72 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
cuebot/src/main/resources/conf/ddl/postgres/migrations/V16__AddShowStats.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
CREATE TABLE show_stats ( | ||
pk_show VARCHAR(36) NOT NULL, | ||
int_frame_insert_count BIGINT DEFAULT 0 NOT NULL, | ||
int_job_insert_count BIGINT DEFAULT 0 NOT NULL, | ||
int_frame_success_count BIGINT DEFAULT 0 NOT NULL, | ||
int_frame_fail_count BIGINT DEFAULT 0 NOT NULL | ||
); | ||
|
||
INSERT INTO show_stats ( | ||
pk_show, | ||
int_frame_insert_count, | ||
int_job_insert_count, | ||
int_frame_success_count, | ||
int_frame_fail_count | ||
) SELECT | ||
pk_show, | ||
int_frame_insert_count, | ||
int_job_insert_count, | ||
int_frame_success_count, | ||
int_frame_fail_count | ||
FROM show; | ||
|
||
CREATE UNIQUE INDEX c_show_stats_pk ON show_stats (pk_show); | ||
ALTER TABLE show_stats ADD CONSTRAINT c_show_stats_pk PRIMARY KEY | ||
USING INDEX c_show_stats_pk; | ||
|
||
|
||
-- Destructive changes. Please test changes above prior to executing this. | ||
ALTER TABLE show | ||
DROP COLUMN int_frame_insert_count, | ||
DROP COLUMN int_job_insert_count, | ||
DROP COLUMN int_frame_success_count, | ||
DROP COLUMN int_frame_fail_count; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@DiegoTavares I think there's a missing semicolon in line 3
OpenCue/cuebot/src/main/resources/conf/ddl/postgres/seed_data.sql
Line 3 in d2057d3