Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFLnU-0000So-KX for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Nov 2017 15:09:45 +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 1eFLnT-0006Rg-HT for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Nov 2017 15:09:43 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eFLnT-0006RW-46 for pgsql-hackers@lists.postgresql.org; Thu, 16 Nov 2017 15:09:43 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eFLnP-0005OV-TG for pgsql-hackers@postgresql.org; Thu, 16 Nov 2017 15:09:42 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 5001E21C06A7; Thu, 16 Nov 2017 18:09:38 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from [192.168.27.109] (unknown [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 2787521C0644; Thu, 16 Nov 2017 18:09:38 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1510844978; bh=NAt+fzMUYUF2oQ88LMhPo01lT22qLzq+zNnyckRbU6Y=; h=Subject:To:References:From:Date:In-Reply-To; b=OfMkpgreB9P8ly7gc7siA8HGLO68tWKm67jorzNrQwxcwS/NfZaHYbwI2HpLFohFG qA3DYzNoDR3T6F1magLgF7zN6A6DTGv2WisUj6xc0vlGi5+e74ibmpcy+RtM5XtyWU W9hWvI6gBg/Rki6gzcyQI/TvKosoTCzOQAI5wF7Y= Subject: Re: [HACKERS] Custom compression methods To: Ildus Kurbangaliev , pgsql-hackers@postgresql.org References: <20170907194236.4cefce96@wp.localdomain> <20170912175505.4afa11fd@wp.localdomain> <20171102152836.60c041e4@wp.localdomain> <20171114162356.52e3d388@wp.localdomain> From: Ildar Musin Message-ID: Date: Thu, 16 Nov 2017 18:09:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20171114162356.52e3d388@wp.localdomain> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Ildus, On 14.11.2017 16:23, Ildus Kurbangaliev wrote: > On Thu, 2 Nov 2017 15:28:36 +0300 Ildus Kurbangaliev > wrote: > >> On Tue, 12 Sep 2017 17:55:05 +0300 Ildus Kurbangaliev >> wrote: >> >>> >>> Attached rebased version of the patch. Added support of pg_dump, >>> the code was simplified, and a separate cache for compression >>> options was added. >>> >> >> Attached version 3 of the patch. Rebased to the current master, >> removed ALTER TYPE .. SET COMPRESSED syntax, fixed bug in >> compression options cache. >> > > Attached version 4 of the patch. Fixed pg_upgrade and few other > bugs. > I've started to review your code. And even though it's fine overall I have few questions and comments (aside from DROP COMPRESSION METHOD discussion). 1. I'm not sure about proposed syntax for ALTER TABLE command: >> ALTER TABLE t ALTER COLUMN a SET COMPRESSED WITH >> (); ALTER TABLE t ALTER COLUMN a SET NOT COMPRESSED; ISTM it is more common for Postgres to use syntax like SET/DROP for column options (SET/DROP NOT NULL, DEFAULT etc). My suggestion would be: ALTER TABLE t ALTER COLUMN a SET COMPRESSED USING WITH (); ALTER TABLE t ALTER COLUMN a DROP COMPRESSED; (keyword USING here is similar to "CREATE INDEX ... USING " syntax) 2. The way you changed DefineRelation() implies that caller is responsible for creation of compression options. Probably it would be better to create them within DefineRelation(). 3. Few minor issues which seem like obsolete code: Function freeRelOptions() is defined but never used. Function getBaseTypeTuple() has been extracted from getBaseTypeAndTypmod() but never used separately. In toast_flatten_tuple_to_datum() there is untoasted_value variable which is only used for meaningless assignment. (Should I send a patch for that kind of issues?) -- Ildar Musin i.musin@postgrespro.ru