Reputation: 162
sources said that the aggregate function MAX() has a better performance that select order desc limit 1
but after executing the query from a table with 43000 records, MAX() takes about 1.5 seconds and the other takes 350ms
and when both are used in inner queries, for about 1 minute MAX() is still executing while the other yield results for 94ms
can anyone enlighten me? I'd really appreciate it
Upvotes: 1
Views: 514
Reputation: 12356
It is all about the INDEX
es and the keys that you use. use EXPLAIN
to see where your bottlenecks are - http://dev.mysql.com/doc/refman/5.0/en/using-explain.html.
Upvotes: 2