-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(Impact View): Concurrent Refresh on impact view
Makes the Impact Materialized View able to be refreshed concurrently by adding an unique index
- Loading branch information
1 parent
a31a77d
commit 309d795
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
api/src/migrations/1667497567675-ImpactMaterializedViewUniqueIndex.ts
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,18 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class ImpactMaterializedViewUniqueIndex1667497567675 | ||
implements MigrationInterface | ||
{ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
DROP INDEX IF EXISTS idx_georegion_h3data_indexed; | ||
CREATE UNIQUE INDEX idx_georegion_h3data_indexed ON impact_materialized_view ("geoRegionId", "h3DataId", "h3index") INCLUDE ("value"); | ||
`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
DROP INDEX IF EXISTS idx_georegion_h3data_indexed; | ||
`); | ||
} | ||
} |
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