Subject Re: Optimize first clause in select query
Author Adam
--- In, "diwic2" <diwic2@...> wrote:
> First the problem, the query takes about 30 seconds to execute, which
> is way too long for my application. Under those 30 seconds fbserver
> eats 100% CPU and takes 100 MB in RAM (the RAM stuff is not a problem,
> but the time is).
> I have this query:

Try Ann's suggestion. If that does not work, this should (but you lose
the nodeid index. Given that the specific node is in 99% of records,
there is probably no benefit to using it. You would need an index on PID.

select first 200 msg, pid from my_messages
where nodeid+0 = 104000007 and pid >= 3000
order by pid