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
On 12/20/2012 12:26 AM, Gavin Flower wrote:
CREATE TABLE test (id int, int sub, text payload);
CREATE INDEX test_idx1 ON test (id, sub);
CREATE INDEX test_idx2 ON test (id);


Now test_idx2 is logically included in test_idx1, but if the majority of transactions only query on id, then test_idx2 would be more better as it ties up less RAM

if sub is an integer, that index isn't that much larger.  both indexes need to index all the rows, and with the header and block overhead, the extra word isn't that big of a deal.   as long as there are some transactions using the other index, most of both of them will likely want to be in memory, so you'll end up using MORE memory.


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