You could just use the benchmark function?
select BENCHMARK(10000000, 'dfsfsdfs' like 'F%' ) /* 0.45 sec. */
select BENCHMARK(10000000, 'dfsfsdfs' between 'F' and 'Fzzz' ) /* 0.55
select BENCHMARK(10000000, left('dfsfsdfs',1)='F' ) /* 0.79 sec. */
The times go up a little if the strings are a match.
From: Roger Baklund [mailto:roger@stripped]
Sent: Wednesday, January 21, 2004 1:11 PM
Cc: Hassan Shaikh
Subject: Re: Efficient SQL Statement
* Hassan Shaikh
> Which one of the following statements is more efficient?
> SELECT * FROM COUNTRY WHERE LEFT(CNNAME,1)='B';
> SELECT * FROM COUNTRY WHERE CNNAME LIKE 'B%';
The second statement will normally be the most effective, because the
don't need to perform a function on the column for each row. However,
LIKE operator is relatively "heavy", the _most_ effective in this case
SELECT * FROM COUNTRY WHERE CNNAME>='B' AND CNNAME<'C'
SELECT * FROM COUNTRY WHERE CNNAME BETWEEN 'B' AND 'Bzzz'
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql