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 1gPAHb-0004lk-Et for pgsql-docs@arkaria.postgresql.org; Tue, 20 Nov 2018 17:57:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gPAHZ-0003vS-VZ for pgsql-docs@arkaria.postgresql.org; Tue, 20 Nov 2018 17:57:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gPAHZ-0003vE-M2 for pgsql-docs@lists.postgresql.org; Tue, 20 Nov 2018 17:57:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gPAHW-0001PS-Vo for pgsql-docs@lists.postgresql.org; Tue, 20 Nov 2018 17:57:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wAKHvjbR025343; Tue, 20 Nov 2018 12:57:45 -0500 From: Tom Lane To: "Jonathan S. Katz" cc: Bruce Momjian , emilioplatzer@gmail.com, pgsql-docs@lists.postgresql.org, Alvaro Herrera Subject: Re: Documentation for create unique index is insuficient and (because of that) incorrect In-reply-to: <11974.1542727002@sss.pgh.pa.us> References: <154031939560.30897.14677735588262722042@wrigleys.postgresql.org> <20181120020542.GH28656@momjian.us> <9ba37df7-156b-b983-65b5-85ed096818b9@postgresql.org> <11323.1542725958@sss.pgh.pa.us> <11974.1542727002@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 20 Nov 2018 10:16:42 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25341.1542736665.1@sss.pgh.pa.us> Date: Tue, 20 Nov 2018 12:57:45 -0500 Message-ID: <25342.1542736665@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > "Jonathan S. Katz" 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