Re: Is unique index always used if query is on first constituent column ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: Rajesh Kumar Mallah <mallah(dot)rajesh(at)gmail(dot)com>, Lista Postgres <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Is unique index always used if query is on first constituent column ?
Date: 2006-12-30 18:06:50
Message-ID: 13436.1167502010@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> Rajesh Kumar Mallah <mallah(dot)rajesh(at)gmail(dot)com> wrote:
>> create unique index ab on t(a,b);
>> create index b on t(b);

> If the b data is large you might get some performance increase from adding
> an index on just a. You will be trading off increased work when doing updates
> to handle the extra index versus faster searches in a more compact index.

This is covered in some detail in TFM:
http://www.postgresql.org/docs/8.2/static/indexes-multicolumn.html
http://www.postgresql.org/docs/8.2/static/indexes-bitmap-scans.html

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Shahryar G. Hashemi 2007-01-02 02:14:37 pg_restore: [archiver (db)] could not execute query: ERROR: zero-length delimited identifier at or near """" at character 60
Previous Message Bruno Wolff III 2006-12-30 17:15:28 Re: Is unique index always used if query is on first constituent column ?