Re: discarding duplicate indexes - Mailing list pgsql-hackers

From John R Pierce
Subject Re: discarding duplicate indexes
Date
Msg-id 50D2D17E.1030303@hogranch.com
Whole thread Raw
In response to Re: discarding duplicate indexes  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
List pgsql-hackers
<div class="moz-cite-prefix">On 12/20/2012 12:26 AM, Gavin Flower wrote:<br /></div><blockquote
cite="mid:50D2CBC4.6070006@archidevsys.co.nz"type="cite"><pre wrap="">CREATE TABLE test (id int, int sub, text
payload);
CREATE INDEX test_idx1 ON test (id, sub);
CREATE INDEX test_idx2 ON test (id);


<big><font face="Liberation Serif, serif"><font size="3"><big>Now <font face="Liberation Mono,
monospace">test_idx2</font>is logically included in <font face="Liberation Mono, monospace">test_idx1</font>, but if
themajority of transactions only query on <font face="Liberation Mono, monospace">id</font>, then <font
face="LiberationMono, monospace">test_idx2</font> would be more better as it ties up less
RAM</big></font></font></big></pre></blockquote><br/> if sub is an integer, that index isn't that much larger.  both
indexesneed to index all the rows, and with the header and block overhead, the extra word isn't that big of a deal.  
aslong as there are some transactions using the other index, most of both of them will likely want to be in memory, so
you'llend up using MORE memory.<br /><br /><br /> 

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] trouble with pg_upgrade 9.0 -> 9.1
Next
From: Simon Riggs
Date:
Subject: Re: Review of Row Level Security