Re: discarding duplicate indexes

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: discarding duplicate indexes
Date: 2012-12-20 08:26:44
Message-ID: 50D2CBC4.6070006@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20/12/12 14:57, Josh Kupershmidt wrote:
> CREATE TABLE test (id int);
> CREATE INDEX test_idx1 ON test (id);
> CREATE INDEX test_idx2 ON test (id);
I initially misread your example code, but after I realised my mistake,
I thought of an alternative scenario that might be worth considering.

CREATE TABLE test (id int, int sub, text payload);
CREATE INDEX test_idx1 ON test (id, sub);
CREATE INDEX test_idx2 ON test (id);

Nowtest_idx2 is logically included intest_idx1, but if the majority of transactions only query onid, thentest_idx2 would be more better as it ties up less RAM

Cheers,
Gavin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2012-12-20 08:42:51 Re: [GENERAL] trouble with pg_upgrade 9.0 -> 9.1
Previous Message Brendan Jurd 2012-12-20 06:40:51 Re: operator dependency of commutator and negator, redux