MySQL Forums
Forum List  »  Optimizer & Parser

Re: Double Index Performance
Posted by: Björn Steinbrink
Date: January 13, 2006 05:18PM

What about this?
SELECT MAX(PostDate) FROM Person_Test WHERE PersonId = 1

Even simpler (IMHO) and EXPLAIN agrees on performance:
mysql> explain SELECT MAX(PostDate) FROM Person_Test where PersonId=1;
+----+-------------+-------+------+---------------+------+---------+------+------+------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+------+------------------------------+
| 1 | SIMPLE | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Select tables optimized away |
+----+-------------+-------+------+---------------+------+---------+------+------+------------------------------+
1 row in set (0.00 sec)

Options: ReplyQuote


Subject
Views
Written By
Posted
7848
January 12, 2006 02:21PM
Re: Double Index Performance
3028
January 13, 2006 05:18PM
2625
January 16, 2006 06:24AM
2687
January 16, 2006 08:46AM
2338
January 17, 2006 06:45AM
2537
February 01, 2006 01:05PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.