Ja det er index på start_number og end_number. Men det er stadigt bare voldsomt sløvt. Er ved at sætte en dedikeret maskine op til opgaven med masser af CPU, RAM og hurtige diske. Måske det kan hjælpe lidt på det også.
mysql> EXPLAIN SELECT * FROM ich WHERE start_number <=43669090 AND end_number >=43669090; +----+-------------+-------+------+-------------------------+------+---------+------+---------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+-------------------------+------+---------+------+---------+-------------+ | 1 | SIMPLE | ich | ALL | start_number,end_number | NULL | NULL | NULL | 3765149 | Using where | +----+-------------+-------+------+-------------------------+------+---------+------+---------+-------------+ 1 row in set (0.00 sec)
mysql> EXPLAIN SELECT * FROM ich WHERE start_number <=12345678 AND end_number >=12345678; +----+-------------+-------+-------+-------------------------+--------------+---------+------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+-------+-------------------------+--------------+---------+------+------+-------------+ | 1 | SIMPLE | ich | range | start_number,end_number | start_number | 8 | NULL | 1 | Using where | +----+-------------+-------+-------+-------------------------+--------------+---------+------+------+-------------+ 1 row in set (0.00 sec)
mysql> EXPLAIN SELECT * FROM ich WHERE 43669090 BETWEEN start_number AND end_number; +----+-------------+-------+------+-------------------------+------+---------+------+---------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+-------------------------+------+---------+------+---------+-------------+ | 1 | SIMPLE | ich | ALL | start_number,end_number | NULL | NULL | NULL | 3753234 | Using where | +----+-------------+-------+------+-------------------------+------+---------+------+---------+-------------+ 1 row in set (0.00 sec)
mysql> EXPLAIN SELECT * FROM ich WHERE 12345678 BETWEEN start_number AND end_number; +----+-------------+-------+-------+-------------------------+--------------+---------+------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+-------+-------------------------+--------------+---------+------+------+-------------+ | 1 | SIMPLE | ich | range | start_number,end_number | start_number | 8 | NULL | 1 | Using where | +----+-------------+-------+-------+-------------------------+--------------+---------+------+------+-------------+ 1 row in set (0.00 sec)
Ja, det er jo så lige det.. Jeg fik aldrig løst problemet, da projektet blev nedlagt.. Men hvis der er nogen af jer som vil have pointene er det bare at smide et svar. =)
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.