Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pP7c1-00046G-BI for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Feb 2023 19:57:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pP7c0-0002mY-2d for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Feb 2023 19:57:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pP7bz-0002lm-OU for pgsql-hackers@lists.postgresql.org; Mon, 06 Feb 2023 19:57:11 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pP7bw-0004zP-78 for pgsql-hackers@postgresql.org; Mon, 06 Feb 2023 19:57:11 +0000 Received: by mail-wr1-x42f.google.com with SMTP id m14so11472174wrg.13 for ; Mon, 06 Feb 2023 11:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SSXLhtsULxaBFiivAEJITBoS7vKcz5mAuAnv+XZHFNA=; b=MQQq1zgu1WvyohFMN56Rc5mDjeJB1MIBJxz0lKt8sdgd91YI8ZfRe/zHhL0YqtRT8d DshhxtFz++5owzgsTlHWqJ14i7gs63ZfLBIaoLGUngsfB6JXon+4lq47c1RHST9ySRNt DS3slNIgrXyINNoanERZluc01OgE9TRx66rMfO69bp3H+pTO5o0hq/QLjxnb9XC9/pwq r1L3DIY/lll+LEUH2GR/BV0CIl0MeHUAKkTGsy9+d2h76Qq15E17o8W78weOeuDTFUWX QWjrWpraUbb8xdPqj7P1vROMlVOynu63yLcJlVEmS9enUH+cyRZQx4ygTSAvKZhYRMLI lVVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SSXLhtsULxaBFiivAEJITBoS7vKcz5mAuAnv+XZHFNA=; b=fm2viRHCeybC8rjvaO39+O70gUBajhjgmHX3N2ze87YsFEA43Q/DSQnVIg0ttTu8Qs jxeN8ti+AKF8NuE5xqKI+kvFWkIjjzvCl8ECRQ5ZhTNYPSlFCCKVElNuUpGlfYmtVARI t27erkWRHTPsDfxSBG2UVXbwFia8jKPhYsDpaYBFa/5wXTgp8J3Gvc3taymojb3ZOOwS IxXVRaQ+bA5eTJs0VJbpvzqH+G0qnpMNvkN2w+soKdZv64mGnwODC4PorrJqz+60dlEh Zu+TEFe7j/j8VfKGqN32+Fs3gQEuF5iyOlXwAGHdri1EeLP3Eo9q9Uj1kd9Xiy//GjPB QO5A== X-Gm-Message-State: AO0yUKXUVIwSizArF71ZdwdjgH/oeUXs8U64Pw6PB44U4nSM1odILCD/ kL4wHLURqSRCMqAj/nbhB5HW24l/h2oroyNDhWpm3HHrKvMdE0aMgex6zntZ8Wm1kLCEDPwYK9I te35bkVhgEUdk/cLH2vOHmoVyBRN9nZ0S0JpwG0nONVpgyNpz9/UbSb2II1nOcLPVuA5mYp+PXp CckzXV4LRyBIiLpmIWS7YKCVhegQIXPyJl1cMxT4dekkqh1SLSXgz5r9J6SyXH1K8iFjI7RWit7 TOF5ZbPsl3WLP2wefkh9Ssob54hDJ19niRX X-Google-Smtp-Source: AK7set+N8G8ZNJUM065EcM1rVbpdkNThWJ95u4ZOADMPcDEvXGU7SHCC5YQzLfeut5lu+PGTDx2CWw== X-Received: by 2002:adf:eb83:0:b0:2c3:ddbe:d7b2 with SMTP id t3-20020adfeb83000000b002c3ddbed7b2mr49555wrn.62.1675713426120; Mon, 06 Feb 2023 11:57:06 -0800 (PST) Received: from [10.137.0.17] (ip-86-49-228-162.bb.vodafone.cz. [86.49.228.162]) by smtp.gmail.com with ESMTPSA id q16-20020adff950000000b002bff574a250sm9604182wrr.2.2023.02.06.11.57.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Feb 2023 11:57:05 -0800 (PST) Message-ID: <0ecaec9d-861b-c74f-846b-b64d929507ef@enterprisedb.com> Date: Mon, 6 Feb 2023 20:57:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: pglz compression performance, take two Content-Language: en-US To: Andrey Borodin Cc: Ian Lawrence Barwick , Andrey Borodin , Mark Dilger , Justin Pryzby , pgsql-hackers@postgresql.org References: <20201230043930.GG25152@telsasoft.com> <20210122024811.GE27167@telsasoft.com> <88C049C6-1B86-4EF7-940D-585B07FEB81B@yandex-team.ru> <90649B7F-EF71-40F7-93D0-1029AD0D90F3@enterprisedb.com> <84aa2da0-004d-c8f8-48c8-aa2861d1ff73@enterprisedb.com> <120DD821-48F4-446C-865A-093E560A2143@yandex-team.ru> <0f54129f-255d-2d8f-94a0-d18b6f388745@enterprisedb.com> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/6/23 03:00, Andrey Borodin wrote: > On Sun, Feb 5, 2023 at 5:51 PM Tomas Vondra > wrote: >> >> On 2/5/23 19:36, Andrey Borodin wrote: >>> On Fri, Jan 6, 2023 at 10:02 PM Andrey Borodin wrote: >>>> >>>> Hello! Please find attached v8. >>> >>> I got some interesting feedback from some patch users. >>> There was an oversight that frequently yielded results that are 1,2 or >>> 3 bytes longer than expected. >>> Looking closer I found that the correctness of the last 3-byte tail is >>> checked in two places. PFA fix for this. Previously compressed data >>> was correct, however in some cases few bytes longer than the result of >>> current pglz implementation. >>> >> >> Thanks. What were the consequences of the issue? Lower compression >> ratio, or did we then fail to decompress the data (or would current pglz >> implementation fail to decompress it)? >> > The data was decompressed fine. But extension tests (Citus's columnar > engine) hard-coded a lot of compression ratio stuff. OK. Not sure I'd blame the patch for these failures, as long as long as the result is still correct and can be decompressed. I'm not aware of a specification of what the compression must (not) produce. > And there is still 1 more test where optimized version produces 1 byte > longer output. I'm trying to find it, but with no success yet. > > There are known and documented cases when optimized pglz version would > do so. good_match without 10-division and memcmp by 4 bytes. But even > disabling this, still observing 1-byte longer compression results > persists... The problem is the length is changed after deleting some > data, so compression of that particular sequence seems to be somewhere > far away. > It was funny at the beginning - to hunt for 1 byte. But the weekend is > ending, and it seems that byte slipped from me again... > I wonder what that means for the patch. I haven't investigated this at all, but it seems as if the optimization means we fail to find a match, producing a tad larger output. That may be still be a good tradeoff, as long as the output is correct (assuming it doesn't break some promise regarding expected output). regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company