index question

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: index question
Date: 2001-10-19 00:25:44
Message-ID: 3BCF7308.4060302@selectacast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Lets say I have a table with columns a and b. I want to do a query like
SELECT count(distinct b) WHERE a = 2;

Should I have an index on a or an index on (a,b)?

--
Joseph Shraibman
jks(at)selectacast(dot)net
Increase signal to noise ratio. http://www.targabot.com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joseph Shraibman 2001-10-19 01:25:19 Re: When will vacuum go away?
Previous Message Oleg Lebedev 2001-10-18 23:04:25 Re: COUNT func