Hello Maja, > EXPLAIN ANALYSE SELECT * FROM system_alarm WHERE id_camera='3' AND > confirmed='false' AND dismissed='false' ORDER BY date DESC, time DESC > LIMIT 1; > > (the table is indexed by id_camera, has around 1 milion rows, and this > query returns around 700000 rows and is executed (EXPLAIN ANALYSE) in > around 4800 ms, and this table is queried a lot although not so often > queried modified) 700.000 of 1.000.000 rows is around 70% ... that are nearly all rows. As much as I read you, this table is not often modified. What reason is there for quering all that data again and again instead of keeping it in memory (should it be really needed) ? Harald -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Spielberger Straße 49 70435 Stuttgart 0173/9409607 no fx, no carrier pigeon - EuroPython 2009 will take place in Birmingham - Stay tuned!