![]() |
|< 1 2 3 >| | ![]() |
24 Einträge, 3 Seiten |
1
2
3
4
5
6
7
8
9
10
$i=0;
while(1) {
warn $i;
$sql = qq{SELECT accesslog_id FROM accesslog WHERE accessdate >= "2004-01-01 00:00:00" LIMIT $i,1000};
$sth = $g_dbh->prepare($sql);
$sth->execute;
$x = $sth->fetchall_arrayref;
last if not @$x;
$i+=1000;
}'
1 row in set (4 min 32.05 sec)
1
2
mysql> select min(accesslog_id) from accesslog where int_time >1080770400;
1 row in set (4 min 20.73 sec)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
mysql> explain select min(accesslog_id) from accesslog where int_time >1080770400;
+-----------+------+---------------+------+---------+------+----------+------------+
| table | type | possible_keys | key | key_len | ref | rows | Extra |
+-----------+------+---------------+------+---------+------+----------+------------+
| accesslog | ALL | int_time | NULL | NULL | NULL | 13563083 | where used |
+-----------+------+---------------+------+---------+------+----------+------------+
1 row in set (0.01 sec)
mysql> explain select accesslog_id from accesslog where int_time >1080770400 order by accesslog_id LIMIT 0,1;
+-----------+-------+---------------+----------+---------+------+----------+--------------
--------------+
| table | type | possible_keys | key | key_len | ref | rows | Extra |
+-----------+-------+---------------+----------+---------+------+----------+--------------
--------------+
| accesslog | range | int_time | int_time | 5 | NULL | 13563083 | where used; Using filesort |
+-----------+-------+---------------+----------+---------+------+----------+--------------
--------------+
1 row in set (0.00 sec)
1
2
3
4
5
6
7
CREATE TABLE s_ticklist_ETR (
sym char(5) NOT NULL default '',
zeit timestamp(14) NOT NULL,
kurs mediumint(8) unsigned NOT NULL default '0',
volumen mediumint(8) unsigned NOT NULL default '0',
KEY zeit (zeit)
) TYPE=MyISAM PACK_KEYS=1 COMMENT='Tickerliste';
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
SELECT *
FROM s_ticklist_ETR
WHERE zeit > '2004-04-08-12:22:06'
ORDER BY zeit
LIMIT 0 , 1
0.0024 sek
EXPLAIN
table type possible_keys key key_len ref rows Extra
s_ticklist_ETR range zeit zeit 4 NULL 5008 Using where
-------------------------------------------------------------------------------
SELECT *
FROM s_ticklist_ETR
WHERE zeit > '2004-04-08-12:22:06'
LIMIT 0 , 1
0.0019 sek
EXPLAIN
table type possible_keys key key_len ref rows Extra
s_ticklist_ETR range zeit zeit 4 NULL 5008 Using where
1
2
3
4
5
6
7
8
9
10
11
12
SELECT *
FROM s_ticklist_ETR
WHERE zeit > '2004-04-08-12:22:06'
ORDER BY zeit
LIMIT 0 , 1
0.2560 sek
EXPLAIN
table type possible_keys key key_len ref rows Extra
s_ticklist_ETR range NULL NULL NULL NULL 160774 Using where; Using filesort
1
2
3
4
5
6
7
8
9
10
11
12
ohne DISTINCT
EXPLAIN
table type possible_keys key key_len ref rows Extra
s_ticklist_ETR range zeit zeit 4 NULL 5008 Using where
mit DISTINCT
EXPLAIN
table type possible_keys key key_len ref rows Extra
s_ticklist_ETR range zeit zeit 4 NULL 5008 Using where; Using temporary
![]() |
|< 1 2 3 >| | ![]() |
24 Einträge, 3 Seiten |