diff --git a/server/migrations/2024-04-11-072642_add-indexes-for-dataset/down.sql b/server/migrations/2024-04-11-072642_add-indexes-for-dataset/down.sql new file mode 100644 index 0000000000..c2265bc335 --- /dev/null +++ b/server/migrations/2024-04-11-072642_add-indexes-for-dataset/down.sql @@ -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; \ No newline at end of file diff --git a/server/migrations/2024-04-11-072642_add-indexes-for-dataset/up.sql b/server/migrations/2024-04-11-072642_add-indexes-for-dataset/up.sql new file mode 100644 index 0000000000..1aa9091269 --- /dev/null +++ b/server/migrations/2024-04-11-072642_add-indexes-for-dataset/up.sql @@ -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); \ No newline at end of file diff --git a/server/src/handlers/chunk_handler.rs b/server/src/handlers/chunk_handler.rs index da8c6f18ce..57b6e17dab 100644 --- a/server/src/handlers/chunk_handler.rs +++ b/server/src/handlers/chunk_handler.rs @@ -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();