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 1iNeAX-0006mg-Lh for pgsql-docs@arkaria.postgresql.org; Thu, 24 Oct 2019 14:32:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iNe9W-0002el-A3 for pgsql-docs@arkaria.postgresql.org; Thu, 24 Oct 2019 14:31:50 +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 1iNe9W-0002ed-2t for pgsql-docs@lists.postgresql.org; Thu, 24 Oct 2019 14:31:50 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNe9S-0001dW-8R for pgsql-docs@lists.postgresql.org; Thu, 24 Oct 2019 14:31:49 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1iNe9Q-0005Dt-Kj; Thu, 24 Oct 2019 10:31:44 -0400 Date: Thu, 24 Oct 2019 10:31:44 -0400 From: Bruce Momjian To: Tuomas Leikola Cc: pgsql-docs@lists.postgresql.org Subject: Re: uniqueness and null could benefit from a hint for dba Message-ID: <20191024143144.GE8650@momjian.us> References: <156760275564.1127.12321702656456074572@wrigleys.postgresql.org> <20190927163747.GE31412@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Oct 23, 2019 at 02:35:02PM +0300, Tuomas Leikola wrote: > That is a nice design. You can create a regular unique index where columns(s)s > are not null and then filtered index(es) for the cases where some of the unique > columns are null. > > However my point, specifically, was that if the document in question would have > offered alternative solutions, I personally would have been saved from some > frustration and an exercise in bad index design (I had 5 nullables that need > uniqueness for the null as well). Maybe it would help someone else. Uh, I am wondering if it is just too details for our docs. Can you think of some text and its location? -- Bruce Momjian 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 +