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

From: "Rajesh Kumar Mallah" <mallah(dot)rajesh(at)gmail(dot)com>
To: "Lista Postgres" <pgsql-admin(at)postgresql(dot)org>
Subject: Is unique index always used if query is on first constituent column ?
Date: 2006-12-30 10:38:39
Message-ID: a97c77030612300238j47f7e52bxb23fe644f0046094@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

suppose we have 2 columns a and b . we need to query by a and sometimes
by b for data consistency UNIQUE(a,b) also needs to be there. we create
indexes below:

create unique index ab on t(a,b);
create index b on t(b);

it has been observed that index ab is used while querying
for a , can we always avoid creating the extra index on a ie,
create index a on t(a); (does other databases also behave
similar?)

Regds
mallah.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Bruno Wolff III 2006-12-30 17:15:28 Re: Is unique index always used if query is on first constituent column ?
Previous Message Andy Shellam (Mailing Lists) 2006-12-30 00:49:30 Re: Frustrating LO problem