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 1gS5vf-0004JD-M5 for pgsql-general@arkaria.postgresql.org; Wed, 28 Nov 2018 19:55:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gS5ve-00058p-DP for pgsql-general@arkaria.postgresql.org; Wed, 28 Nov 2018 19:55:22 +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 1gS5ve-00055l-4R for pgsql-general@lists.postgresql.org; Wed, 28 Nov 2018 19:55:22 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gS5vb-0006uJ-BW for pgsql-general@postgresql.org; Wed, 28 Nov 2018 19:55:21 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 7166C107F7342 for ; Wed, 28 Nov 2018 12:55:17 -0700 (MST) Date: Wed, 28 Nov 2018 12:55:17 -0700 (MST) From: PegoraroF10 To: pgsql-general@postgresql.org Message-ID: <1543434917462-0.post@n3.nabble.com> Subject: Primary Key index with Include 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 As you know version 11 gives us the possibility to include aditional columns to an index. So, if I recreate all my primary key indexes to contain a description column, like ... CREATE UNIQUE INDEX CONCURRENTLY Products_pk ON Products(Product_ID) INCLUDE(Name); ALTER TABLE Products ADD CONSTRAINT Products_pk PRIMARY KEY(Product_ID) USING INDEX Products_pk Then, when I do select Item_ID, Product_ID, Name from Items inner join Products using(Product_ID) I thought It would do a index scan only for Products table, but it does not, why ? What do I need do to use index scan only when searching Product_ID and Name on table Products ? -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html