Thread

Commits

  1. Doc: rework introductory documentation about covering indexes.

  1. Documentation for create unique index is insuficient and (because of that) incorrect

    The Post Office <noreply@postgresql.org> — 2018-10-23T18:29:55Z

    The following documentation comment has been logged on the website:
    
    Page: https://www.postgresql.org/docs/11/static/indexes-unique.html
    Description:
    
    In https://www.postgresql.org/docs/11/static/indexes-unique.html there are
    omited clausules
    
    For example WHERE clausule is omited. 
    
    In https://www.postgresql.org/docs/11/static/sql-createindex.html you can
    see the right sintax with all the clausules.
    
  2. Re: Documentation for create unique index is insuficient and (because of that) incorrect

    Bruce Momjian <bruce@momjian.us> — 2018-11-20T02:05:42Z

    On Tue, Oct 23, 2018 at 06:29:55PM +0000, PG Doc comments form wrote:
    > The following documentation comment has been logged on the website:
    > 
    > Page: https://www.postgresql.org/docs/11/static/indexes-unique.html
    > Description:
    > 
    > In https://www.postgresql.org/docs/11/static/indexes-unique.html there are
    > omited clausules
    > 
    > For example WHERE clausule is omited. 
    > 
    > In https://www.postgresql.org/docs/11/static/sql-createindex.html you can
    > see the right sintax with all the clausules.
    
    The first URL is an example and is not intended to be the complete
    syntax.
    
    -- 
      Bruce Momjian  <bruce@momjian.us>        http://momjian.us
      EnterpriseDB                             http://enterprisedb.com
    
    + As you are, so once was I.  As I am, so you will be. +
    +                      Ancient Roman grave inscription +
    
    
    
  3. Re: Documentation for create unique index is insuficient and (because of that) incorrect

    Jonathan S. Katz <jkatz@postgresql.org> — 2018-11-20T14:41:56Z

    On 11/19/18 9:05 PM, Bruce Momjian wrote:
    > On Tue, Oct 23, 2018 at 06:29:55PM +0000, PG Doc comments form wrote:
    >> The following documentation comment has been logged on the website:
    >>
    >> Page: https://www.postgresql.org/docs/11/static/indexes-unique.html
    >> Description:
    >>
    >> In https://www.postgresql.org/docs/11/static/indexes-unique.html there are
    >> omited clausules
    >>
    >> For example WHERE clausule is omited. 
    >>
    >> In https://www.postgresql.org/docs/11/static/sql-createindex.html you can
    >> see the right sintax with all the clausules.
    > 
    > The first URL is an example and is not intended to be the complete
    > syntax.
    > 
    
    In fairness, the "INCLUDE" clause was added, which is new to PostgreSQL
    11, so it could raise the question as to why aren't other clauses there.
    
    Perhaps we could add some more examples? For instance, why one might
    want to use "INCLUDE" with a unique index. And perhaps a case of the
    "partial unique index" (which I have used in production systems before).
    
    Thanks!
    
    Jonathan
    
    
  4. Re: Documentation for create unique index is insuficient and (because of that) incorrect

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2018-11-20T14:52:42Z

    On 2018-Nov-20, Jonathan S. Katz wrote:
    
    > On 11/19/18 9:05 PM, Bruce Momjian wrote:
    > > On Tue, Oct 23, 2018 at 06:29:55PM +0000, PG Doc comments form wrote:
    > >> The following documentation comment has been logged on the website:
    > >>
    > >> Page: https://www.postgresql.org/docs/11/static/indexes-unique.html
    > >> Description:
    > >>
    > >> In https://www.postgresql.org/docs/11/static/indexes-unique.html there are
    > >> omited clausules
    > >>
    > >> For example WHERE clausule is omited. 
    > >>
    > >> In https://www.postgresql.org/docs/11/static/sql-createindex.html you can
    > >> see the right sintax with all the clausules.
    > > 
    > > The first URL is an example and is not intended to be the complete
    > > syntax.
    
    I think the OP should take a lengthier look at the whole of chapter 11
    instead of looking at just one individual section within it.  It's the
    whole chapter that should include details about other indexing features
    -- and indeed the WHERE clause is described in 11.8 Partial Indexes.
    
    Describing every feature within the section for every other feature
    would be disastrous.
    
    > In fairness, the "INCLUDE" clause was added, which is new to PostgreSQL
    > 11, so it could raise the question as to why aren't other clauses there.
    
    IMO that's actually a bug -- the INCLUDE clause should have gotten its
    own section in chapter 11 instead of being mentioned in the section
    about unique indexes.
    
    -- 
    Álvaro Herrera                https://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
  5. Re: Documentation for create unique index is insuficient and (because of that) incorrect

    Tom Lane <tgl@sss.pgh.pa.us> — 2018-11-20T14:59:18Z

    "Jonathan S. Katz" <jkatz@postgresql.org> writes:
    > On 11/19/18 9:05 PM, Bruce Momjian wrote:
    >> On Tue, Oct 23, 2018 at 06:29:55PM +0000, PG Doc comments form wrote:
    >>> In https://www.postgresql.org/docs/11/static/indexes-unique.html there are
    >>> omited clausules
    
    >> The first URL is an example and is not intended to be the complete
    >> syntax.
    
    > In fairness, the "INCLUDE" clause was added, which is new to PostgreSQL
    > 11, so it could raise the question as to why aren't other clauses there.
    
    Yes.  That was a dumb idea; the correct fix is to take that out, because
    it's not appropriate here.  There might be room for an additional section
    later in the chapter that discusses INCLUDE, but we shouldn't be
    cluttering the discussion of fundamental concepts like unique indexes
    with that.
    
    			regards, tom lane
    
    
    
  6. Re: Documentation for create unique index is insuficient and (because of that) incorrect

    Jonathan S. Katz <jkatz@postgresql.org> — 2018-11-20T15:02:01Z

    On 11/20/18 9:59 AM, Tom Lane wrote:
    > "Jonathan S. Katz" <jkatz@postgresql.org> writes:
    >> On 11/19/18 9:05 PM, Bruce Momjian wrote:
    >>> On Tue, Oct 23, 2018 at 06:29:55PM +0000, PG Doc comments form wrote:
    >>>> In https://www.postgresql.org/docs/11/static/indexes-unique.html there are
    >>>> omited clausules
    > 
    >>> The first URL is an example and is not intended to be the complete
    >>> syntax.
    > 
    >> In fairness, the "INCLUDE" clause was added, which is new to PostgreSQL
    >> 11, so it could raise the question as to why aren't other clauses there.
    > 
    > Yes.  That was a dumb idea; the correct fix is to take that out, because
    > it's not appropriate here.  There might be room for an additional section
    > later in the chapter that discusses INCLUDE, but we shouldn't be
    > cluttering the discussion of fundamental concepts like unique indexes
    > with that.
    
    Shows how closely I read the docs. +1 on removing INCLUDE from UNIQUE
    indexes.
    
    Also +1 on having a section on covering indexes.
    
    Jonathan
    
    
  7. Re: Documentation for create unique index is insuficient and (because of that) incorrect

    Tom Lane <tgl@sss.pgh.pa.us> — 2018-11-20T15:16:42Z

    "Jonathan S. Katz" <jkatz@postgresql.org> writes:
    > On 11/20/18 9:59 AM, Tom Lane wrote:
    >> Yes.  That was a dumb idea; the correct fix is to take that out, because
    >> it's not appropriate here.  There might be room for an additional section
    >> later in the chapter that discusses INCLUDE, but we shouldn't be
    >> cluttering the discussion of fundamental concepts like unique indexes
    >> with that.
    
    > Shows how closely I read the docs. +1 on removing INCLUDE from UNIQUE
    > indexes.
    >
    > Also +1 on having a section on covering indexes.
    
    I see Alvaro is on the same page here.  I'll go write something
    later today.
    
    			regards, tom lane
    
    
    
  8. Re: Documentation for create unique index is insuficient and (because of that) incorrect

    Tom Lane <tgl@sss.pgh.pa.us> — 2018-11-20T17:57:45Z

    I wrote:
    > "Jonathan S. Katz" <jkatz@postgresql.org> writes:
    >> Also +1 on having a section on covering indexes.
    
    > I see Alvaro is on the same page here.  I'll go write something
    > later today.
    
    So looking closer ... not only is the unique-index section not a very
    good fit, but there is already a section that this does fit into
    pretty well, which is 11.11 on index-only scans.  Not only do you need
    to understand index-only scans to understand why you'd want INCLUDE,
    but there's already discussion there of making covering indexes the
    hard way.
    
    So what I think I should do is reformulate that discussion to talk
    about making covering indexes with INCLUDE, and then mention in
    passing that you can also do it without that as long as you don't mind
    the payload columns being part of the index semantics.
    
    I'm also wondering whether to move that section someplace earlier
    in chapter 11.  Right now it's near the end because it's mostly
    info about an implementation detail; but it wouldn't be hard to
    make the argument that covering indexes are more important than,
    say, indexes with custom collations.  Should we move it, and if
    so to where?
    
    			regards, tom lane
    
    
    
  9. Re: Documentation for create unique index is insuficient and (because of that) incorrect

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2018-11-20T18:08:31Z

    On 2018-Nov-20, Tom Lane wrote:
    
    > So what I think I should do is reformulate that discussion to talk
    > about making covering indexes with INCLUDE, and then mention in
    > passing that you can also do it without that as long as you don't mind
    > the payload columns being part of the index semantics.
    
    That seems sensible.
    
    > I'm also wondering whether to move that section someplace earlier
    > in chapter 11.  Right now it's near the end because it's mostly
    > info about an implementation detail; but it wouldn't be hard to
    > make the argument that covering indexes are more important than,
    > say, indexes with custom collations.  Should we move it, and if
    > so to where?
    
    I think right next to 11.5, which currently completes the topic of how
    are indexes used, is a good place.
    
    -- 
    Álvaro Herrera                https://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
  10. Re: Documentation for create unique index is insuficient and (because of that) incorrect

    Jonathan S. Katz <jkatz@postgresql.org> — 2018-11-20T18:13:51Z

    On 11/20/18 1:08 PM, Alvaro Herrera wrote:
    > On 2018-Nov-20, Tom Lane wrote:
    > 
    >> So what I think I should do is reformulate that discussion to talk
    >> about making covering indexes with INCLUDE, and then mention in
    >> passing that you can also do it without that as long as you don't mind
    >> the payload columns being part of the index semantics.
    > 
    > That seems sensible.
    
    +1
    
    > 
    >> I'm also wondering whether to move that section someplace earlier
    >> in chapter 11.  Right now it's near the end because it's mostly
    >> info about an implementation detail; but it wouldn't be hard to
    >> make the argument that covering indexes are more important than,
    >> say, indexes with custom collations.  Should we move it, and if
    >> so to where?
    > 
    > I think right next to 11.5, which currently completes the topic of how
    > are indexes used, is a good place.
    
    I would vote at least before 11.9. You could make arguments how
    understand how multicolumn, expression indexes, partials, etc. could be
    more important, or at least used for frequently in the wild (at least
    for now). And once we've explained those types then you could understand
    how to use covering indexes appropriately.
    
    Jonathan
    
    
  11. Re: Documentation for create unique index is insuficient and (because of that) incorrect

    Tom Lane <tgl@sss.pgh.pa.us> — 2018-11-20T18:15:30Z

    Alvaro Herrera <alvherre@2ndquadrant.com> writes:
    > On 2018-Nov-20, Tom Lane wrote:
    >> I'm also wondering whether to move that section someplace earlier
    >> in chapter 11.  Right now it's near the end because it's mostly
    >> info about an implementation detail; but it wouldn't be hard to
    >> make the argument that covering indexes are more important than,
    >> say, indexes with custom collations.  Should we move it, and if
    >> so to where?
    
    > I think right next to 11.5, which currently completes the topic of how
    > are indexes used, is a good place.
    
    Well, it has to stay after 11.6 (unique indexes), because we do need
    to point out that the included columns don't participate in the
    uniqueness constraint, and I don't want that statement to be a forward
    reference.  Really this boils down to where you rank covering indexes
    vs expression indexes and partial indexes in terms of usefulness.
    I'd tend to put this after expression indexes, but I don't have a very
    strong feeling about how to rank it versus partial indexes.
    
    			regards, tom lane