Skip to content

Commit

Permalink
speedup: add indexes to dataset and stripe sub
Browse files Browse the repository at this point in the history
  • Loading branch information
densumesh committed Apr 11, 2024
1 parent 0a30061 commit 6b5f28b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- This file should undo anything in `up.sql`
ALTER TABLE datasets DROP INDEX datasets_organization_id_index;
ALTER TABLE stripe_subscriptions DROP INDEX stripe_subscriptions_plan_id_index;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Your SQL goes here
CREATE INDEX IF NOT EXISTS datasets_organization_id_index ON datasets (organization_id);
CREATE INDEX IF NOT EXISTS stripe_subscriptions_plan_id_index ON stripe_subscriptions (plan_id);
17 changes: 10 additions & 7 deletions server/src/handlers/chunk_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,16 +352,19 @@ pub async fn create_chunk(
}
}

let group_ids_from_group_tracking_ids = if let Some(group_tracking_ids) =
chunk.group_tracking_ids.clone()
{
get_group_ids_from_tracking_ids_query(group_tracking_ids, count_dataset_id, pool.clone())
let group_ids_from_group_tracking_ids =
if let Some(group_tracking_ids) = chunk.group_tracking_ids.clone() {
get_group_ids_from_tracking_ids_query(
group_tracking_ids,
count_dataset_id,
pool.clone(),
)
.await
.ok()
.unwrap_or(vec![])
} else {
vec![]
};
} else {
vec![]
};

let initial_group_ids = chunk.group_ids.clone().unwrap_or_default();
let mut chunk_only_group_ids = chunk.clone();
Expand Down

0 comments on commit 6b5f28b

Please sign in to comment.