From 277b88a8def42159d4e77f12ddb462caba55d7c3 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Sun, 22 Mar 2020 21:05:59 +0100
Subject: mod_storage_sql: Add index covering sort_id to improve performance
 (fixes #1505)

---
 plugins/mod_storage_sql.lua | 1 +
 1 file changed, 1 insertion(+)

(limited to 'plugins')

diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index 73207073..5b1c3603 100644
--- a/plugins/mod_storage_sql.lua
+++ b/plugins/mod_storage_sql.lua
@@ -500,6 +500,7 @@ local function create_table(engine) -- luacheck: ignore 431/engine
 		Index { name="prosodyarchive_index", unique = engine.params.driver ~= "MySQL", "host", "user", "store", "key" };
 		Index { name="prosodyarchive_with_when", "host", "user", "store", "with", "when" };
 		Index { name="prosodyarchive_when", "host", "user", "store", "when" };
+		Index { name="prosodyarchive_sort", "host", "user", "store", "sort_id" };
 	};
 	engine:transaction(function()
 		ProsodyArchiveTable:create(engine);
-- 
cgit v1.2.3