Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewBX1-000271-El for pgsql-general@arkaria.postgresql.org; Wed, 14 Mar 2018 18:53:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ewBX0-0007xT-2F for pgsql-general@arkaria.postgresql.org; Wed, 14 Mar 2018 18:53:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewBWz-0007xK-NR for pgsql-general@lists.postgresql.org; Wed, 14 Mar 2018 18:53:45 +0000 Received: from 23-25-19-49-static.hfc.comcastbusiness.net ([23.25.19.49] helo=jeeves.wrkhors.com) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ewBWw-00066P-VQ for pgsql-general@lists.postgresql.org; Wed, 14 Mar 2018 18:53:44 +0000 Received: from wrkhors.com (localhost [127.0.0.1]) by jeeves.wrkhors.com (Postfix) with ESMTP id CAE7D11D7; Wed, 14 Mar 2018 13:58:38 -0500 (CDT) Date: Wed, 14 Mar 2018 13:52:34 -0500 From: Steven Lembark To: pgsql-general@lists.postgresql.org Cc: lembark@wrkhors.com Subject: Re: Primary key gist index? Message-ID: <20180314135234.55f60040@wrkhors.com> In-Reply-To: <420e0752-1197-c1be-c50c-eba42f35ad99@illuminatedcomputing.com> References: <420e0752-1197-c1be-c50c-eba42f35ad99@illuminatedcomputing.com> Organization: Workhorse Computing MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, 14 Mar 2018 11:28:59 -0700 Paul Jungwirth wrote: > > EXCLUDE USING gist (id WITH =, as_of_date WITH &&) > null), but maybe there are other primary-key duties it doesn't meet, > like defining foreign keys that reference it. I've been on-and-off The PK does provide a unique index. It may be worth adding and index on id where ( upper as_of_date = infinity ) for faster searches of current id's (assuming, of course, that there is an infinite value for upper of as_of_date). You will also need a PK if the table is used in foreign key constraints -- the other table has to ref this table's PK. -- Steven Lembark 1505 National Ave Workhorse Computing Rockford, IL 61103 lembark@wrkhors.com +1 888 359 3508