Bonjour,
je recherche un moyen de joindre ces 2 grosses tables dans un temps raisonnable.
Les 2 tables :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 mysql> describe databases.ancestral; +--------+-----------------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-----------------------------------------------+------+-----+---------+-------+ | chr | tinyint(4) unsigned | NO | MUL | NULL | | | pos | int(11) unsigned | NO | | NULL | | | allele | enum('A','C','T','G','a','c','t','g','N','-') | NO | | NULL | | +--------+-----------------------------------------------+------+-----+---------+-------+ mysql> describe data.get_ancestral; +-----------+---------------------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------------------------------------------------+------+-----+---------+-------+ | chr | tinyint(3) unsigned | NO | MUL | NULL | | | pos | int(10) unsigned | NO | | NULL | | | ancestral | enum('.','A','C','T','G','a','c','t','g','N','-') | NO | | NULL | | +-----------+---------------------------------------------------+------+-----+---------+-------+
- ancestral contient 2 786 295 961 enregristrement (50GO)
- get_ancestral contient 1 623 542 enregistrement (26.3MO)
J'ai essayé avec ou sans index, et le temps est toujours tres elevé.
Voici le describe des requetes ou :
- ancestral a 'chr' pour index
- ancestral2 a 'chr, pos' pour index
- ancestral3 a aucun index
Ma grande question :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 mysql> explain select count(*) from databases.ancestral natural join data.get_ancestral; +----+-------------+---------------+------+---------------+------+---------+------------------------+---------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+---------------+------+---------------+------+---------+------------------------+---------+-------------+ | 1 | SIMPLE | get_ancestral | ALL | chr | NULL | NULL | NULL | 1623542 | | | 1 | SIMPLE | ancestral | ref | chr | chr | 1 | data.get_ancestral.chr | 2206 | Using where | +----+-------------+---------------+------+---------------+------+---------+------------------------+---------+-------------+ 2 rows in set (0.00 sec) mysql> explain select count(*) from databases.ancestral2 natural join data.get_ancestral; +----+-------------+---------------+------+---------------+------+---------+-----------------------------------------------+---------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+---------------+------+---------------+------+---------+-----------------------------------------------+---------+-------------+ | 1 | SIMPLE | get_ancestral | ALL | chr | NULL | NULL | NULL | 1623542 | | | 1 | SIMPLE | ancestral2 | ref | chr | chr | 5 | data.get_ancestral.chr,data.get_ancestral.pos | 2206 | Using index | +----+-------------+---------------+------+---------------+------+---------+-----------------------------------------------+---------+-------------+ 2 rows in set (0.00 sec) mysql> explain select count(*) from databases.ancestral3 natural join data.get_ancestral; +----+-------------+---------------+------+---------------+------+---------+--------------------------+------------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+---------------+------+---------------+------+---------+--------------------------+------------+-------------+ | 1 | SIMPLE | ancestral3 | ALL | NULL | NULL | NULL | NULL | 2786295961 | | | 1 | SIMPLE | get_ancestral | ref | chr | chr | 1 | databases.ancestral3.chr | 15 | Using where | +----+-------------+---------------+------+---------------+------+---------+--------------------------+------------+-------------+ 2 rows in set (0.00 sec)
Est ce qu'il y a quelque chose a améliorer, ou est ce que j'essaie de faire une requête impossible?
Merci de votre aide
Z.
Partager