From 2db0c760cd0d0df0595c82d939c8076d7da3d340 Mon Sep 17 00:00:00 2001 From: Juanga Covas <1177241+juangacovas@users.noreply.github.com> Date: Fri, 24 Sep 2021 23:12:54 +0200 Subject: [PATCH] Index for nid in users table Considering that class.auth.php, line 306, does a SELECT ... WHERE nid = ... it could be wise to add an unique index for "nid". Query response time very noticeable when you start having +100 users or even less... --- mysql.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql.sql b/mysql.sql index ed56e03..e4a8e96 100644 --- a/mysql.sql +++ b/mysql.sql @@ -21,5 +21,6 @@ CREATE TABLE `users` ( `level` enum('user','admin') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'user', `twostep` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `username` (`username`) + UNIQUE KEY `username` (`username`), + UNIQUE KEY `nid` (`nid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;