From f86055378d6337c0e0b1555067f76e62f9265c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Fri, 18 Feb 2022 14:01:22 +0100 Subject: Optimize room_unused_* commands Previously to check if hibernated room was old enough we had to fetch info about all rooms from database. Now we repurpose created_at field in sql to store that info, that allow us to have more efficient query just for it. --- sql/mysql.new.sql | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/mysql.new.sql') diff --git a/sql/mysql.new.sql b/sql/mysql.new.sql index a5d03c8c7..dc514becf 100644 --- a/sql/mysql.new.sql +++ b/sql/mysql.new.sql @@ -301,6 +301,7 @@ CREATE TABLE muc_room ( ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE UNIQUE INDEX i_muc_room_name_host USING BTREE ON muc_room(name(75), host(75)); +CREATE INDEX i_muc_room_host_created_at ON muc_room(host(75), created_at); CREATE TABLE muc_registered ( jid text NOT NULL, -- cgit v1.2.3