Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFiAo-0002mh-Fj for pgsql-hackers@arkaria.postgresql.org; Sun, 14 Apr 2019 16:40:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hFiAn-0008Og-AK for pgsql-hackers@arkaria.postgresql.org; Sun, 14 Apr 2019 16:40:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFiAn-0008OZ-1o for pgsql-hackers@lists.postgresql.org; Sun, 14 Apr 2019 16:40:05 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFiAk-0000ll-AQ for pgsql-hackers@postgresql.org; Sun, 14 Apr 2019 16:40:04 +0000 Received: by mail-wr1-x443.google.com with SMTP id s15so18562473wra.12 for ; Sun, 14 Apr 2019 09:40:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=dmpctK5o8fSFTTlZdstcLupL+/VQ3VWlU+invt8E6sw=; b=MMHpwJoZcHcJkb2uRONJMW6C0JTkDkDcsCP1KyPJf5pI02bX47pdObYU6qBAr4JsmB ZAQYIWAeRDteHSPC78R/SJsdW2R5z3kR2ZMXi8E0sLYk4gjWhuecvhxi/fEcbJryEIZG 3ly221+C7f3YuwvstEw1M31AteadrQb3sxhaDmb9W3McV53dSyBz5hVd/T4AsMVfOWrK if8FnoW32WyGYZQbUJsjJUvRtnpcKe3ktrWGD2b15/5zcWI9jiDFus3Ad5lyclM6yob9 M0cbe8n8L7wBt8VRlc9bn+sAP5EXh/01r7B0XpKCN6m34rxcUuPw7CYejWTWtfTGOW8H 9fUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=dmpctK5o8fSFTTlZdstcLupL+/VQ3VWlU+invt8E6sw=; b=ZxMyG6RID4V6Z1NOnkuMpRVFsCGOomnyfIjA0bMVR13HqfwsNSSthC7EEiim4ta7SZ xQddTZ8bM/4nLTAl/WDxe2zl1/fq6bJLuicsclJowmNgQpZKOC9h5jtDfZihmalLCgr0 yFxqbXcrVYLmy+FWtk7tZXd19URWCmzMenLlkQwUdkQTBYbQq9RrOeOKPB+1F5c/CnZp bjQs0eRo9zdeoqmWAsdhiDF3hmhArFXiw3M+Y4PvYsv0kxVs+3sm9AuVJ7E3FVV6UYIV 45iirDlK4lWlXvSzODeKpVa4Y5RlRcslHKDQrE904KMATeaq2LGW2Fh9SnaaUZoKqXVh N8Ig== X-Gm-Message-State: APjAAAUKvO0FHsnsXZbVS+qvXKa04h3sINKT5UL96nU3HH8E5o6TY2p/ rNWEDioe2bVfbwZLuPoBQoy/UQ== X-Google-Smtp-Source: APXvYqxAwW0BGNGsfyOnn4Ff6+PpSLWbdkcxzvDuWOnamA7xyu2NOKcP/63bTYVgRH64FE0d5pdqUg== X-Received: by 2002:a5d:42c5:: with SMTP id t5mr14483838wrr.275.1555260001376; Sun, 14 Apr 2019 09:40:01 -0700 (PDT) Received: from localhost (ip-86-49-243-43.net.upcbroadband.cz. [86.49.243.43]) by smtp.gmail.com with ESMTPSA id c10sm56784665wru.83.2019.04.14.09.39.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 09:39:49 -0700 (PDT) Date: Sun, 14 Apr 2019 18:39:47 +0200 From: Tomas Vondra To: Heikki Linnakangas Cc: Tom Lane , Ashwin Agrawal , Mark Kirkwood , PostgreSQL mailing lists Subject: Re: Zedstore - compressed in-core columnar storage Message-ID: <20190414163947.owdw4gyjui36rakf@development> References: <6A2B85A8-1ABD-4F85-981E-C94172D662FD@pivotal.io> <11257.1554994460@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716-1444-295967 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Apr 11, 2019 at 06:20:47PM +0300, Heikki Linnakangas wrote: >On 11/04/2019 17:54, Tom Lane wrote: >>Ashwin Agrawal writes: >>>Thank you for trying it out. Yes, noticed for certain patterns pg_lzcompress() actually requires much larger output buffers. Like for one 86 len source it required 2296 len output buffer. Current zedstore code doesn’t handle this case and errors out. LZ4 for same patterns works fine, would highly recommend using LZ4 only, as anyways speed is very fast as well with it. >> >>You realize of course that *every* compression method has some inputs that >>it makes bigger. If your code assumes that compression always produces a >>smaller string, that's a bug in your code, not the compression algorithm. > >Of course. The code is not making that assumption, although clearly >there is a bug there somewhere because it throws that error. It's >early days.. > >In practice it's easy to weasel out of that, by storing the data >uncompressed, if compression would make it longer. Then you need an >extra flag somewhere to indicate whether it's compressed or not. It >doesn't break the theoretical limit because the actual stored length >is then original length + 1 bit, but it's usually not hard to find a >place for one extra bit. > Don't we already have that flag, though? I see ZSCompressedBtreeItem has t_flags, and there's ZSBT_COMPRESSED, but maybe it's more complicated. -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services