From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 74D946955E
 for <pmg-devel@lists.proxmox.com>; Mon, 22 Mar 2021 17:38:24 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 68216276AF
 for <pmg-devel@lists.proxmox.com>; Mon, 22 Mar 2021 17:38:24 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 44C042769F
 for <pmg-devel@lists.proxmox.com>; Mon, 22 Mar 2021 17:38:23 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 0CFBB4636C
 for <pmg-devel@lists.proxmox.com>; Mon, 22 Mar 2021 17:38:23 +0100 (CET)
Message-ID: <521287bf-b6d2-5ff3-90e4-84d4a0781923@proxmox.com>
Date: Mon, 22 Mar 2021 17:38:22 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:87.0) Gecko/20100101
 Thunderbird/87.0
Content-Language: en-US
To: Stoiko Ivanov <s.ivanov@proxmox.com>
Cc: pmg-devel@lists.proxmox.com
References: <20210322090046.26278-1-t.lamprecht@proxmox.com>
 <20210322150615.2894ba90@rosa.proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
In-Reply-To: <20210322150615.2894ba90@rosa.proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.045 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.001 Looks like a legit reply (A)
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pmg-devel] [PATCH] fix #3164: api: quarantine: allow to return
 spam from all users
X-BeenThere: pmg-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Mail Gateway development discussion
 <pmg-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pmg-devel/>
List-Post: <mailto:pmg-devel@lists.proxmox.com>
List-Help: <mailto:pmg-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 22 Mar 2021 16:38:24 -0000

On 22.03.21 15:06, Stoiko Ivanov wrote:
> Huge thanks for tackling this feature quite a few users have asked and
> have been waiting for!
> 
> 
> On Mon, 22 Mar 2021 10:00:44 +0100
> Thomas Lamprecht <t.lamprecht@proxmox.com> wrote:
> 
>> The pmail was only checked for the spam quarantine call, and there
>> mainly to ensure that the quarantine user only can check their own
>> mails. Make the pmail parameter also optional for this quarantine
>> related endpoint as long as one has a role other than quser.
>> This allows to query all spam quarantine entries from all pmails at
>> once, providing the backend side to address #3164.
>>
>> The main argument against this was performance, but postgres can
>> handle even hundreds of thousands of rows rather fine, it's a high
>> performant database after all and this is quite the simple query (no
>> joins, functions on columns or nested queries).
> agreed @postgres being a performant dbms - small nit - the quarantine
> query has a join (it's quering cmsreceivers and cmailstore in one query)
> 

you're naturally right, the psql explain even said so - but I did that one
only after writing above paragraph so forgot to adapt it.

> On my machine a 30k mail test-set even showed some room for improvement
> with the postgres parameters (sorting resorting to a temp-file for <
> 10Megs sounds like a bad tradeoff) - however this is a different topic and
> as you said - users with huge deployments using quarantine, hopefully know
> how to tweak a few postgres parameters.
> 
> 
> quickly gave your patches a spin - it works quite well on my test-setup
> (currently at 48k mails selecting 'all' takes 5s in the GUI (and yields
> 10.4MB of results)
> 
> The changes to pmg-api look good!
> The ones to pmg-gui and proxmox-widet-toolkit as well (but I'm not the
> best judge of java-script code)
> 
> with that said:
> Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
> Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
> 

Much thanks for looking at this, applied with above tags.