Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePXEW-0000zS-A7 for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Dec 2017 17:23:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePXEV-00079N-TZ for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Dec 2017 17:23:43 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ePXEV-00079D-Jw for pgsql-hackers@lists.postgresql.org; Thu, 14 Dec 2017 17:23:43 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ePXES-0000ia-1b for pgsql-hackers@postgresql.org; Thu, 14 Dec 2017 17:23:42 +0000 Received: by mail-wm0-x243.google.com with SMTP id f9so12973686wmh.0 for ; Thu, 14 Dec 2017 09:23:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=pz0FVvMOTN+FzsIEnr45S7gzPrutrcEfZSkkLrB6Sho=; b=yjv8tjFTUOcDGGRDYH65SHamouB8Dt3zBKFBVxKGgoma9p1P/e5Cl+b3+n/ae4I7W1 PHuCGzHDMXrWEoQet/UXQ4Io6XpXOYC9aK8HzavTaCV3ksN6vmclRbvQY9pw4OPkWNJW OkoqWAOhCrAiul4yVy8aHyX/iOuSo2OWHF+BUcrjp9AIcB9+YLexiKrGKv3dfDJ0sGbj UccilgDuxhtQHHEkOZgSna5VRV0H23bvCJjKw516Lc87A0wnmdJUoTXQ+lOLNGwTsNYn TO8gb53R/jDlqnrauTKymPsCWW1tVKN+Go04Ax3Zg2jej9rE/f/h4mVcalbMo0l9fD4G 9TLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pz0FVvMOTN+FzsIEnr45S7gzPrutrcEfZSkkLrB6Sho=; b=JoMIU7u4/2NpWusRJ7ET6hhI8xJrr+Wo5cDZevp7T76MO3Z9HTaqnmeFlfy9oqWszy 4DH4LvRhbDBnuyd/sls4S661YZJpZOTfSYKp6rX0fGPid7J/YPOW/kulzKXWb+zDkBLY Okdj0MqRSZyg6fQ+17j0FHnKa34u2p3hNUvwAdXJ2+4r+qhtetx9Z/dy4U88lKEf4znL zQcOXhyupwFBjYu4h/t71iAjCYYNIXac/CHvlSJD+VykFji/DAwP6U/RH4elOZquLgRm 9oLctMXV4gy9xAOD0Y4xDqwhr0XPvpvpKyAXxB1mNDtc10Kn8vqVmcRHfDciyeDxMwKg VlYg== X-Gm-Message-State: AKGB3mI9mn8PJrxU84lVKUkQpmSCpNiUNGuO8/vCoE1Aa4ecAUI0qV7j z8B2c/uA56IkIsfOf3KW3x+MguQWXNTxlOjgZjj/MEhhqZ0et01oxmvjEx6hUxC3tlu0+dILcKe S0fPI0ohge1MtXBCLmi3OevxxIu9F4O7wPwPcLlhFHen5HkBQ8vT4GEguWRd3QZPcIlZZ4uxV6a L/oHkzInnK X-Google-Smtp-Source: ACJfBoustbyz5HmISO5rQxuVYqSscwY4yZjSWqLf054Ye1dfyToX/22zj2FMfBfPj+L7BOnGfJYYng== X-Received: by 10.80.212.158 with SMTP id s30mr13517730edi.286.1513272218134; Thu, 14 Dec 2017 09:23:38 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id h20sm4041745edh.69.2017.12.14.09.23.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Dec 2017 09:23:33 -0800 (PST) Subject: Re: [HACKERS] Custom compression methods To: Robert Haas Cc: Ildus Kurbangaliev , "pgsql-hackers@postgresql.org" References: <20170907194236.4cefce96@wp.localdomain> <29527031-c837-59e1-760d-677bb33d6b0f@2ndquadrant.com> From: Tomas Vondra Message-ID: Date: Thu, 14 Dec 2017 18:23:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/14/2017 04:21 PM, Robert Haas wrote: > On Wed, Dec 13, 2017 at 5:10 AM, Tomas Vondra > wrote: >>> 2. If several data types can benefit from a similar approach, it has >>> to be separately implemented for each one. >> >> I don't think the current solution improves that, though. If you >> want to exploit internal features of individual data types, it >> pretty much requires code customized to every such data type. >> >> For example you can't take the tsvector compression and just slap >> it on tsquery, because it relies on knowledge of internal tsvector >> structure. So you need separate implementations anyway. > > I don't think that's necessarily true. Certainly, it's true that > *if* tsvector compression depends on knowledge of internal tsvector > structure, *then* that you can't use the implementation for anything > else (this, by the way, means that there needs to be some way for a > compression method to reject being applied to a column of a data > type it doesn't like). I believe such dependency (on implementation details) is pretty much the main benefit of datatype-aware compression methods. If you don't rely on such assumption, then I'd say it's a general-purpose compression method. > However, it seems possible to imagine compression algorithms that can > work for a variety of data types, too. There might be a compression > algorithm that is theoretically a general-purpose algorithm but has > features which are particularly well-suited to, say, JSON or XML > data, because it looks for word boundaries to decide on what strings > to insert into the compression dictionary. > Can you give an example of such algorithm? Because I haven't seen such example, and I find arguments based on hypothetical compression methods somewhat suspicious. FWIW I'm not against considering such compression methods, but OTOH it may not be such a great primary use case to drive the overall design. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services