From 4fe40b220eb7b75fa3cbc39bcc30bd4783a7407b Mon Sep 17 00:00:00 2001 From: Ske Date: Thu, 16 Apr 2020 18:23:56 +0200 Subject: [PATCH] Optimize latch-mode autoproxy query --- PluralKit.Core/Services/PostgresDataStore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PluralKit.Core/Services/PostgresDataStore.cs b/PluralKit.Core/Services/PostgresDataStore.cs index b15fc2bf..7c5a2b04 100644 --- a/PluralKit.Core/Services/PostgresDataStore.cs +++ b/PluralKit.Core/Services/PostgresDataStore.cs @@ -342,7 +342,7 @@ namespace PluralKit.Core { public async Task GetLastMessageInGuild(ulong account, ulong guild) { using var conn = await _conn.Obtain(); - return (await conn.QueryAsync("select messages.*, members.*, systems.* from messages, members, systems where messages.guild = @Guild and messages.sender = @Uid and messages.member = members.id and systems.id = members.system order by mid desc limit 1", (msg, member, system) => new FullMessage + return (await conn.QueryAsync("select messages.*, members.*, systems.* from messages left join members on members.id = messages.member left join systems on systems.id = members.system where messages.guild = @Guild and messages.sender = @Uid order by mid desc limit 1", (msg, member, system) => new FullMessage { Message = msg, System = system,