Skip to content

Commit

Permalink
Create indexes (#178)
Browse files Browse the repository at this point in the history
Creates extra indexes to improve the report generation performance.

Signed-off-by: Rémy Greinhofer <[email protected]>
  • Loading branch information
rgreinho authored Jan 3, 2025
1 parent 85af6e2 commit 2fc6293
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions migration/src/m20220101_000001_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@ impl MigrationTrait for Migration {
.to_owned(),
)
.await?;
manager
.create_index(
Index::create()
.table(Census::Table)
.col(Census::CityId)
.col((Census::CreatedAt, IndexOrder::Desc))
.to_owned(),
)
.await?;

// Create the speed limit table.
manager
Expand Down Expand Up @@ -389,6 +398,15 @@ impl MigrationTrait for Migration {
.to_owned(),
)
.await?;
manager
.create_index(
Index::create()
.table(SpeedLimit::Table)
.col(SpeedLimit::CityId)
.col((SpeedLimit::CreatedAt, IndexOrder::Desc))
.to_owned(),
)
.await?;

// Create the Summary table.
manager
Expand All @@ -413,6 +431,16 @@ impl MigrationTrait for Migration {
.to_owned(),
)
.await?;
manager
.create_index(
Index::create()
.table(Summary::Table)
.col(Summary::CityId)
.col((Summary::CreatedAt, IndexOrder::Desc))
.col((Summary::Version, IndexOrder::Desc))
.to_owned(),
)
.await?;

// Create the People table.
manager
Expand Down

0 comments on commit 2fc6293

Please sign in to comment.