| From: | PegoraroF10 <marcos(at)f10(dot)com(dot)br> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Primary Key index with Include |
| Date: | 2018-11-28 19:55:17 |
| Message-ID: | 1543434917462-0.post@n3.nabble.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Klaver | 2018-11-28 20:34:52 | Re: Primary Key index with Include |
| Previous Message | Hannes Erven | 2018-11-28 16:21:02 | Force Reconnect of streaming replication |