MYSQL

HOW TO BENCHMARK MYSQL QUERY TIME

Just run query in MYSQL command line. MYSQL is set to show query execution time by default.

RUN MYSQL IN COMMAND LINE

01

MYSQL TOOLS & MANAGERS

02

These tools will also show the query execution time.

SET profiling = 1; Run your statements; SHOW PROFILES;

MYSQL QUERY PROFILING

03

BENCHMARK(LOOP, STATEMENT)

BENCHMARK FUNCTION

04

BENCHMARK(1000, 1+1) - EXAMPLE, RUN 1+1 FOR 1000 TIMES

$runs = 1000; $start = microtime(true); $stmt = $pdo->prepare(STATEMENT); for ($i=0; $i<$runs; $i++)   { $stmt->execute(); } $end = microtime(true); $taken = $end - $start;

WRITE MANUAL TEST SCRIPT

05

BENCHMARKING TOOLS

06