Re: [SQL] Index question

2004-05-31 Thread Tom Lane
"David Witham" <[EMAIL PROTECTED]> writes: > I understand that selecting count(*) will involve a scan at some > stage, but I was surprised that the index wasn't used in the >= case, > but was used in the between case. Given the estimated row counts in your examples, the planner's choices are not s

Re: [SQL] Index question

2004-02-12 Thread David Witham
magnitude too low. However, it used the index I wanted and the >= case didn't. Regards, David -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Friday, 13 February 2004 16:38 To: David Witham Cc: [EMAIL PROTECTED] Subject: Re: [SQL] Index question "David

Re: [SQL] index question

2001-10-18 Thread Tom Lane
Joseph Shraibman <[EMAIL PROTECTED]> writes: > 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)? At present, only an index on a will help any. Our implementation of count(distinct