Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 6B2999FA102 for ; Sat, 30 Dec 2006 06:38:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 29876-10 for ; Sat, 30 Dec 2006 06:38:40 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.180]) by postgresql.org (Postfix) with ESMTP id 3343B9F9BEC for ; Sat, 30 Dec 2006 06:38:40 -0400 (AST) Received: by py-out-1112.google.com with SMTP id a73so1737378pye for ; Sat, 30 Dec 2006 02:38:39 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=OnfhymL9mqb2+6Vza4+frlNWEVoW+ZQSQgVUMPeZrZ5zNup4ekuVec9rSYQiRJky3/E/WuOXPKjJxcNCoOyfmBIBgJWuVEkWYo8GQD5k770E4YbfQjarJyobOkMCgnfTt5JZTCaeN6kKIY0kZ5L2t/m/Mjyd1N9DxvfaJTl8UFU= Received: by 10.35.96.11 with SMTP id y11mr31255722pyl.1167475119212; Sat, 30 Dec 2006 02:38:39 -0800 (PST) Received: by 10.35.80.8 with HTTP; Sat, 30 Dec 2006 02:38:39 -0800 (PST) Message-ID: Date: Sat, 30 Dec 2006 16:08:39 +0530 From: "Rajesh Kumar Mallah" To: "Lista Postgres" Subject: Is unique index always used if query is on first constituent column ? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/362 X-Sequence-Number: 24154 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.