Subject Slow select min()
Author Kirill Nesterenko
Hello,

I have a query which runs very slow:
select min(id) from stat where user_id = 100

There are indices on both fields: PK_STAT PRIMARY KEY (ID);
and STAT_USER_ID ON STAT (USER_ID);

there are about 3M records in the table, but only 2 records with this
user_id (I don't think it should take 600ms to find out which id is the
minimum anyway..);
also if I run select max(id) - it runs immediately.


Thank you,
Kirill.