From: Stephen Frost <sfrost@snowman.net>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: no default hash partition
Date: Wed, 7 Aug 2019 10:04:03 -0400
Message-ID: <20190807140403.GH29202@tamriel.snowman.net> (raw)
In-Reply-To: <CA+HiwqFVmp1HF6KT_jpch9kvCrydivDdW-gP1XhUOUznG_by-Q@mail.gmail.com>
References: <20190806225310.GA17708@alvherre.pgsql>
<16738.1565132324@sss.pgh.pa.us>
<CA+TgmoZpAsYY+naYpuw+fG=J1wYTXrhk=3uEYYa_Nz=Jwck+eg@mail.gmail.com>
<20190807.135834.105525400.horikyota.ntt@gmail.com>
<CA+HiwqFVmp1HF6KT_jpch9kvCrydivDdW-gP1XhUOUznG_by-Q@mail.gmail.com>
Greetings,
* Amit Langote (amitlangote09@gmail.com) wrote:
> On Wed, Aug 7, 2019 at 1:59 PM Kyotaro Horiguchi
> <horikyota.ntt@gmail.com> wrote:
> > At Tue, 6 Aug 2019 23:26:19 -0400, Robert Haas <robertmhaas@gmail.com> wrote:
> > > On Tue, Aug 6, 2019 at 6:58 PM Tom Lane <tgl@sss.pgh.pa.us> 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+ <parent>
> > contains the Partitoins section that shows a list of
> > partitions. I think that we can show all gaps there.
> >
> > =# \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)
>
> 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
Attachments:
signature.asc (application/pgp-signature, 818B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: sfrost@snowman.net, amitlangote09@gmail.com, horikyota.ntt@gmail.com, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com
Subject: Re: no default hash partition
In-Reply-To: <20190807140403.GH29202@tamriel.snowman.net>
References: <20190806225310.GA17708@alvherre.pgsql> <16738.1565132324@sss.pgh.pa.us> <CA+TgmoZpAsYY+naYpuw+fG=J1wYTXrhk=3uEYYa_Nz=Jwck+eg@mail.gmail.com> <20190807.135834.105525400.horikyota.ntt@gmail.com> <CA+HiwqFVmp1HF6KT_jpch9kvCrydivDdW-gP1XhUOUznG_by-Q@mail.gmail.com> <20190807140403.GH29202@tamriel.snowman.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox