1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mysql> explain select * from orm where oid='10000';
+----+-------------+-------+------+---------------+---------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+---------+---------+-------+------+-------------+
| 1 | SIMPLE | orm | ref | PRIMARY,oid | PRIMARY | 302 | const | 23 | Using where |
+----+-------------+-------+------+---------------+---------+---------+-------+------+-------------+
1 row in set (0.00 sec)
mysql> explain select * from orm where oid=10000;
+----+-------------+-------+------+---------------+------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+--------+-------------+
| 1 | SIMPLE | orm | ALL | PRIMARY,oid | NULL | NULL | NULL | 310000 | Using where |
+----+-------------+-------+------+---------------+------+---------+------+--------+-------------+
1 row in set (0.00 sec)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
'show_profiles' => q( my $self = shift; if(not defined $self->{PROF}){ carp "profiling not set"; return; } my $q = q(SHOW PROFILES); my $ar = $self->{DBH}->selectall_arrayref($q); my $sum = 0; print "\n"; foreach my $e(@$ar){ $sum += $e->[1]; print join("\t", @$e), "\n"; } print "\nSummary time: $sum seconds\n"; ),