Add more efficient message pagination index to eliminate temporary b-tree indexing

This commit is contained in:
Jack Kingsman
2026-02-28 21:00:16 -08:00
parent a55166989e
commit 727ac913de
3 changed files with 52 additions and 20 deletions
-1
View File
@@ -84,7 +84,6 @@ CREATE TABLE IF NOT EXISTS contact_name_history (
FOREIGN KEY (public_key) REFERENCES contacts(public_key)
);
CREATE INDEX IF NOT EXISTS idx_messages_conversation ON messages(type, conversation_key);
CREATE INDEX IF NOT EXISTS idx_messages_received ON messages(received_at);
CREATE UNIQUE INDEX IF NOT EXISTS idx_messages_dedup_null_safe
ON messages(type, conversation_key, text, COALESCE(sender_timestamp, 0));