Re: [PROPOSAL] Covering + unique indexes. - Mailing list pgsql-hackers

From José Luis Tallón
Subject Re: [PROPOSAL] Covering + unique indexes.
Date
Msg-id 55F96896.3040409@adv-solutions.net
Whole thread Raw
In response to Re: [PROPOSAL] Covering + unique indexes.  (Anastasia Lubennikova <a.lubennikova@postgrespro.ru>)
Responses Re: [PROPOSAL] Covering + unique indexes.  (Thom Brown <thom@linux.com>)
List pgsql-hackers
<div class="moz-cite-prefix">On 09/15/2015 06:57 PM, Anastasia Lubennikova wrote:<br /></div><blockquote
cite="mid:55F84DF4.5030207@postgrespro.ru"type="cite"> Proposal Clarification.<br /> I see that discussion become too
<spanclass="b-translation__text">complicated. So, I'd like to clarify what we are talking about.<br /><br /> [snip]<br
/>What are we doing now:<br /> CREATE UNIQUE INDEX on tbl(f1,f2);<br /> CREATE INDEX on tbl(f1, f2, f3, f4);<br /><br
/>[snip]</span><br /> Suggestions.<br /> CREATE INDEX idx ON tbl (f1, f2, f3) [UNIQUE ON (f1, f2)] [INCLUDE (f4)];<br
/></blockquote><br/> Summarizing some suggestions upthread, it seems like the "best" syntax would be something similar
to:<br/><br /> -- Non-unique index + "leaf" information (f4)<br /> CREATE INDEX idx ON tbl (f1, f2, f3) [INCLUDING
(f4)]<br/><br /> -- Unique index on f1,f2, + leaf information (f3)<br /> CREATE UNIQUE INDEX idx ON tbl (f1, f2)
[INCLUDING(f3)]<br /><br /> And, even:<br /> ALTER INDEX idx INCLUDING (f4)<br />  ... which would trigger a REINDEX
CONCURRENTLYinternally ?<br /><br /><br /> FWIW this would include also the functionality provided by the suggested<br
/>    CREATE INDEX idx ON tbl (f1, f2, f3) UNIQUE ON (f1, f2);<br /><br /> while being less verbose, IMHO.<br /><br
/><br/> The obvious inconvenient being that the indexes will grow a bit, so fewer entries will fit in memory.<br /><br
/><br/> Also, we don't meddle with WITH clauses (for smgr parameters or the like) nor USING <method> clauses.<br
/>I reckon that implementation might be a bit intrusive (requiring changes to most index AMs even?)<br /><br /><br
/><br/> Thanks!<br /><br />     / J.L.<br /><br /> 

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: [PROPOSAL] VACUUM Progress Checker.
Next
From: Euler Taveira
Date:
Subject: pltcl: sentence improvement