Deze MySQL (5.0.51a-24+lenny2) query is veel te graag, soms kost het 30+ s. De disk is wel heel druk, maar ik had verwacht dat Linux (Debian Lenny) de tmp files wel in het geheugen zou houden.
Hoe kan ik dit verbeteren?
http://dev.mysql.com/doc/...rder-by-optimization.html
sort_buffer_size en read_rnd_buffer_size zijn defaults maar dat zou voldoende moeten zijn.
Hoe kan ik dit verbeteren?
http://dev.mysql.com/doc/...rder-by-optimization.html
sort_buffer_size en read_rnd_buffer_size zijn defaults maar dat zou voldoende moeten zijn.
SQL:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| mysql> explain select id from torrents WHERE category != 8 ORDER BY id DESC LIMIT 1050,35; +----+-------------+-------+-------+---------------------+------------+---------+------+-------+------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+-------+---------------------+------------+---------+------+-------+------------------------------------------+ | 1 | SIMPLE | t | range | category,category_2 | category_2 | 4 | NULL | 88040 | Using where; Using index; Using filesort | +----+-------------+-------+-------+---------------------+------------+---------+------+-------+------------------------------------------+ mysql> show index from torrents; +----------+------------+--------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | +----------+------------+--------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+ | torrents | 0 | PRIMARY | 1 | id | A | 97658 | NULL | NULL | | BTREE | | | torrents | 1 | category | 1 | category | A | 31 | NULL | NULL | | BTREE | | | torrents | 1 | category_2 | 1 | category | A | 31 | NULL | NULL | | BTREE | | | torrents | 1 | category_2 | 2 | id | A | 97658 | NULL | NULL | | BTREE | | +----------+------------+--------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+ |