Hello,
I am using postgres version 7.4, and I read this in the
documentation:
"The aggregate functions sum and count always require a sequential scan
if applied to the entire table."
My understanding of this statement is that if I use count() without a
WHERE clause, then essentially, it is applied to the entire table and
hence requires a seq scan.
But it should not require a seq scan if I have a condition.
For example: I have a table vm_message with an index on column msgid.
Will the following do a sequential scan or an index?
select count(*) from vm_message where msgid = 3;
I used explain, and it said it would do a sequential scan. Why is that?
In fact explain select * from vm_message where msgid = 3 also did a
sequential scan.
What am I doing wrong here? I want it to use my index.
Thanks,
Kashmira