From 3fab58827017041168a769184469cff3722d6c38 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Wed, 23 Oct 2024 00:31:53 -0400 Subject: Make sure (most) queries avoid table scans. I've exempted inserts (they never scan in the first place), queries on `event_sequence` (at most one row), and the coalesce()s used for event replay (for now; these are obviously a performance risk area and need addressing). Method: ``` find .sqlx -name 'query-*.json' -exec jq -r '"explain query plan " + .query + ";"' {} + > explain.sql ``` Then go query by query through the resulting file. --- ...2accdde2e9e4a49e52e74c3d0e28e82a0b01a3c9887f.json | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .sqlx/query-15ec7a8aa11908f8b2022accdde2e9e4a49e52e74c3d0e28e82a0b01a3c9887f.json (limited to '.sqlx/query-15ec7a8aa11908f8b2022accdde2e9e4a49e52e74c3d0e28e82a0b01a3c9887f.json') diff --git a/.sqlx/query-15ec7a8aa11908f8b2022accdde2e9e4a49e52e74c3d0e28e82a0b01a3c9887f.json b/.sqlx/query-15ec7a8aa11908f8b2022accdde2e9e4a49e52e74c3d0e28e82a0b01a3c9887f.json deleted file mode 100644 index 167e768..0000000 --- a/.sqlx/query-15ec7a8aa11908f8b2022accdde2e9e4a49e52e74c3d0e28e82a0b01a3c9887f.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "db_name": "SQLite", - "query": "\n insert into message_deleted (id, deleted_at, deleted_sequence)\n values ($1, $2, $3)\n returning 1 as \"deleted: bool\"\n ", - "describe": { - "columns": [ - { - "name": "deleted: bool", - "ordinal": 0, - "type_info": "Null" - } - ], - "parameters": { - "Right": 3 - }, - "nullable": [ - null - ] - }, - "hash": "15ec7a8aa11908f8b2022accdde2e9e4a49e52e74c3d0e28e82a0b01a3c9887f" -} -- cgit v1.2.3