Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

perf(macrodb): Add email indices to improve link deletion time (#602)

Evan Hutnikc2004d0a7a98
diff --git a/rust/cloud-storage/macro_db_client/migrations/20251212204146_email_delete_indices.sql b/rust/cloud-storage/macro_db_client/migrations/20251212204146_email_delete_indices.sql
new file mode 100644
index 0000000000..7926a95868
--- /dev/null
+++ b/rust/cloud-storage/macro_db_client/migrations/20251212204146_email_delete_indices.sql
@@ -0,0 +1,13 @@
+-- Indices to speed up email link deletion
+CREATE INDEX idx_email_messages_replying_to_id
+ ON public.email_messages (replying_to_id)
+ WHERE replying_to_id IS NOT NULL;
+
+CREATE INDEX idx_email_user_history_thread_id
+ ON public.email_user_history (thread_id);
+
+CREATE INDEX idx_email_threads_link_id
+ ON public.email_threads (link_id);
+
+CREATE INDEX idx_email_messages_link_id
+ ON public.email_messages (link_id);
\ No newline at end of file