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 1hvMXw-0005z3-FH for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Aug 2019 14:04:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hvMXv-0007DQ-5m for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Aug 2019 14:04:07 +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 1hvMXu-0007BE-Qp for pgsql-hackers@lists.postgresql.org; Wed, 07 Aug 2019 14:04:06 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hvMXs-00021V-4t for pgsql-hackers@lists.postgresql.org; Wed, 07 Aug 2019 14:04:06 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 880DB5F79F; Wed, 7 Aug 2019 10:04:03 -0400 (EDT) Date: Wed, 7 Aug 2019 10:04:03 -0400 From: Stephen Frost To: Amit Langote Cc: Kyotaro Horiguchi , Robert Haas , Tom Lane , Alvaro Herrera , PostgreSQL Hackers Subject: Re: no default hash partition Message-ID: <20190807140403.GH29202@tamriel.snowman.net> References: <20190806225310.GA17708@alvherre.pgsql> <16738.1565132324@sss.pgh.pa.us> <20190807.135834.105525400.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="cHoNMQQGHRuibCy4" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --cHoNMQQGHRuibCy4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Amit Langote (amitlangote09@gmail.com) wrote: > On Wed, Aug 7, 2019 at 1:59 PM Kyotaro Horiguchi > wrote: > > At Tue, 6 Aug 2019 23:26:19 -0400, Robert Haas = wrote: > > > On Tue, Aug 6, 2019 at 6:58 PM Tom Lane wrote: > > > I think, as Amit says, that having an automatic partition creation > > > feature for hash partitions (and maybe other kinds, but certainly for > > > hash) would be a useful thing to add to the system. I also think that > > > it might be useful to add some commands to automate partition > > > splitting (and maybe combining) although I think there's some design > > > work to be done there to figure out exactly what we should build. I > > > don't think it's ever useful to have a hash-partitioned table with an > > > incomplete set of partitions long term, but it makes things simpler to > > > allow that temporarily, for example during dump restoration. > > > Therefore, I see no reason why we would want to go to the trouble of > > > allowing hash-partitioned tables to have default partitions; it would > > > just encourage people to do things that don't really make any sense. > > > > +1. > > > > By the way, couldn't we offer a means to check for gaps in a hash > > partition? For example, the output of current \d+ > > contains the Partitoins section that shows a list of > > partitions. I think that we can show all gaps there. > > > > =3D# \d+ p > > Partitioned table "public.p" > > ... > > Partition key: HASH (a) > > Partitions: c1 FOR VALUES WITH (modulus 4, remainder 0), > > c3 FOR VALUES WITH (modulus 4, remainder 3), > > GAP (modulus 4, remainder 1), > > GAP (modulus 4, remainder 2) > > > > Or > > > > Partitions: c1 FOR VALUES WITH (modulus 4, remainder 0), > > c3 FOR VALUES WITH (modulus 4, remainder 3), > > Gaps: (modulus 4, remainder 1), (modulus 4, remainder 2) >=20 > I imagine showing this output would require some non-trivial code on > the client side (?) to figure out the gaps. If our intention in the > long run is to make sure that such gaps only ever appear temporarily, > that is, when running a command to increase the number of hash > partitions (as detailed in Robert's email), then a user would never > see those gaps. So, maybe writing such code wouldn't be worthwhile in > the long run? I tend to agree that it might not be useful to have this code, particularly not on the client side, but we've dealt with the issue of "the client would need non-trivial code for this" in the past by having a server-side function for the client to call (eg: pg_get_expr(), pg_get_ruledef()). If we really think this would be valuable to show and we don't want the client to have to have a bunch of code for it, doing something similar here could address that. One thing I've wished for is a function that would give me a range type back for a partition (would be neat to be able to use a range type to specify a partition's range when creating it too). Thanks, Stephen --cHoNMQQGHRuibCy4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJdStpTAAoJEO1sijiDR2RVlLkQALhrefejnGrLfaiJasa2goql TteB3jCegYWxjX+CD0j6mMGRksH11ZG9/tDbA7cJyMRKT1v2gyXrXHp9gIvV555n Xl4F37b6+i0AJIPvgfMoUZCr/9PTR8WabFyER1AzZ6h+5uQY9NyAQsSCE45S9DWN FGgjuFm/zmIL6AS38WDJfyGOrKfyjyDGM1bZNshpHM1Sj3xBywK6PkuQCWk7AZMK /tRmWkvRXwbI6cOV3xMwQN87IW32tkFnVo53E9NXLb9LS4DaPsbbNFbVJGAurt7E Y+6UghHe757jz4ihNtY0BP9nX1SKp4NSUZQAFknKP8+ViYAvxka9ewUCZhSc9dI0 jCFzgxu/8POyGRTKD77w/Lv0J/kADYMknqtIdhoNxrzYyx5hOIardJGfai98+fdb rX53mKyHG+9wciAwmp71NCOnMfVlZ6aGi6GqGQgU4ZvDb/M1sVuCyHbwifgEws4j AQ4Of1V8l79Tk5pV+GGHLfiA6qQhdPSCvXDVES3UCDQN7GJ+1x4v2R1RCagA8rMm 1aeZfNZPNC8ldaZPoqC+/iI4kobgYfBvw+zjUNcqumyUYCXibCbWaApQE07kPVFy wNaNXLKdJ/vGTxyBzqO0YKrF2DfYSwZngS2zjb0h5Q27KoQHX6xksIU9aJ0XDeof cCDSui2c3aFJVjcNGCX+ =i1yu -----END PGP SIGNATURE----- --cHoNMQQGHRuibCy4--