Oracle 5.0 Reference Manual page 978

Table of Contents

Advertisement

The
[957]
BENCHMARK()
be used to time how quickly MySQL processes the expression. The result value is always 0. The
intended use is from within the
mysql>
SELECT BENCHMARK(1000000,ENCODE('hello','goodbye'));
+----------------------------------------------+
| BENCHMARK(1000000,ENCODE('hello','goodbye')) |
+----------------------------------------------+
|
+----------------------------------------------+
1 row in set (4.74 sec)
The time reported is elapsed time on the client end, not CPU time on the server end. It is advisable
to execute
BENCHMARK()
loaded the server machine is.
[957]
BENCHMARK()
which has some significant implications for the way that you use it and interpret the results:
• Only scalar expressions can be used. Although the expression can be a subquery, it must return
a single column and at most a single row. For example,
[957]
will fail if the table
t))
• Executing a
SELECT expr
in terms of the amount of overhead involved. The two have very different execution
expr)
profiles and you should not expect them to take the same amount of time. The former involves
the parser, optimizer, table locking, and runtime evaluation
runtime evaluation
allocated are reused, and runtime optimizations such as local caching of results already evaluated
for aggregate functions can alter the results. Use of
performance of the runtime component by giving more weight to that component and removing the
"noise" introduced by the network, parser, optimizer, and so forth.
[958]
CHARSET(str)
Returns the character set of the string argument.
mysql>
SELECT CHARSET('abc');
-> 'latin1'
mysql>
SELECT CHARSET(CONVERT('abc' USING utf8));
-> 'utf8'
mysql>
SELECT CHARSET(USER());
-> 'utf8'
COERCIBILITY(str)
Returns the collation coercibility value of the string argument.
mysql>
SELECT COERCIBILITY('abc' COLLATE latin1_swedish_ci);
-> 0
mysql>
SELECT COERCIBILITY(USER());
-> 3
mysql>
SELECT COERCIBILITY('abc');
-> 4
The return values have the meanings shown in the following table. Lower values have higher
precedence.
Coercibility
Meaning
Explicit
0
collation
No collation
1
Information Functions
function executes the expression
client, which reports query execution times:
mysql
[957]
several times, and to interpret the result with regard to how heavily
is intended for measuring the runtime performance of scalar expressions,
has more than one column or more than one row.
t
statement
times differs from executing
N
times, and all the other components just once. Memory structures already
N
[958]
Example
Value with
COLLATE
Concatenation of strings with different collations
958
repeatedly
expr
0 |
BENCHMARK(10, (SELECT * FROM
SELECT BENCHMARK(N,
times each. The latter involves only
N
[957]
BENCHMARK()
clause
times. It may
count
thus measures

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents