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. --- ...26764e49f00a94e43226ee6aebdd14d7be97a708d66263a30abf.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .sqlx/query-2f26bccedd1226764e49f00a94e43226ee6aebdd14d7be97a708d66263a30abf.json (limited to '.sqlx/query-2f26bccedd1226764e49f00a94e43226ee6aebdd14d7be97a708d66263a30abf.json') diff --git a/.sqlx/query-2f26bccedd1226764e49f00a94e43226ee6aebdd14d7be97a708d66263a30abf.json b/.sqlx/query-2f26bccedd1226764e49f00a94e43226ee6aebdd14d7be97a708d66263a30abf.json new file mode 100644 index 0000000..686afb9 --- /dev/null +++ b/.sqlx/query-2f26bccedd1226764e49f00a94e43226ee6aebdd14d7be97a708d66263a30abf.json @@ -0,0 +1,12 @@ +{ + "db_name": "SQLite", + "query": "\n insert into message_deleted (id, deleted_at, deleted_sequence)\n values ($1, $2, $3)\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 3 + }, + "nullable": [] + }, + "hash": "2f26bccedd1226764e49f00a94e43226ee6aebdd14d7be97a708d66263a30abf" +} -- cgit v1.2.3