pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Teodor Sigaev <teodor@sigaev.ru>
To: Jim Nasby <Jim.Nasby@BlueTreble.com>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: [PROPOSAL] Covering + unique indexes.
Date: Tue, 15 Sep 2015 09:16:41 +0300
Message-ID: <55F7B7C9.6090109@sigaev.ru> (raw)
In-Reply-To: <55F73FDA.2030001@BlueTreble.com>
References: <55F2C1BC.3010109@postgrespro.ru>
	<55F2CCD0.7040608@postgrespro.ru>
	<55F6F7AD.4080307@BlueTreble.com>
	<55F70D0A.2030503@sigaev.ru>
	<CAEepm=2G4jdaoXHU0PJ7MqLms88==r44z9bvLpnzjyOTDzwAEw@mail.gmail.com>
	<55F73FDA.2030001@BlueTreble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

> CREATE INDEX ... ON table (f1, f2, f3) UNIQUE(f1, f2) INCLUDE(f4);

I don't see an advantage this form. What is f3 column? just order? and 
f4 will not be used for compare?  At least now it requires additional 
checks that UNIQUE() fields are the same as first columns in definition. 
Non ordering field f4 will  require invasive intervention in planner 
because now it believes that all columns in btree are ordered. 	

I agree, that form
CREATE UNIQUE INDEX i ON t (f1, f2, f3) INCLUDE (f4)
is clear. f4 will be used in row compare and actually planner will be 
able to use it as unique index (f1, f2, f3) with additional f4 or as
as unique index (f1, f2, f3, f4), because uniqueness on (f1, f2, f3) 
gives warranty of uniqueness on (f1, f2, f3, f4)



-- 
Teodor Sigaev                      E-mail: teodor@sigaev.ru
                                       WWW: http://www.sigaev.ru/


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (35+ messages)  latest in thread

Message-ID: <55F7B7C9.6090109@sigaev.ru>
Permalink:  ../55F7B7C9.6090109@sigaev.ru/
Also on:    postgresql.org/message-id/55F7B7C9.6090109@sigaev.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: teodor@sigaev.ru, Jim.Nasby@BlueTreble.com, thomas.munro@enterprisedb.com, a.lubennikova@postgrespro.ru
  Subject: Re: [PROPOSAL] Covering + unique indexes.
  In-Reply-To: <55F7B7C9.6090109@sigaev.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox