On Wednesday 14 January 2004 18:22, Matthew Lunnon wrote:
> select logid, agentid, logbody from log where logid=3000000;
>
> this query also returns after about 120 seconds. The table log has about
> 7 million records, and logid is the primary key of log table. What about
> that? Why is it too slow?
How about
select logid, agentid, logbody from log where logid='3000000';
or
select logid, agentid, logbody from log where logid=3000000::int4;
Basically you need to typecast the constant. Then it would use the index.
I am not sure of first form of it though. I recommend you use the later form.
Shridhar