- EXPLAIN ANALYZE
- SELECT A.ID,A.name AS FATHER, C.NAME AS MOTHER,B.NAME AS CHILDER,B.SEX
- FROM father A
- LEFT JOIN childer B ON A.ID=B.father_id
- LEFT JOIN mother C ON A.ID=husband_id;
复制代码- -> Nested loop left join (cost=50.65 rows=252) (actual time=0.360..1.926 rows=9 loops=1)
- -> Nested loop left join (cost=9.70 rows=63) (actual time=0.248..1.163 rows=9 loops=1)
- -> Table scan on A (cost=1.15 rows=9) (actual time=0.162..0.205 rows=9 loops=1)
- -> Filter: (b.father_id = a.id) (cost=0.33 rows=7) (actual time=0.079..0.105 rows=1 loops=9)
- -> Table scan on B (cost=0.33 rows=7) (actual time=0.063..0.100 rows=7 loops=9)
- -> Filter: (c.husband_id = a.id) (cost=0.26 rows=4) (actual time=0.069..0.083 rows=0 loops=9)
- -> Table scan on C (cost=0.26 rows=4) (actual time=0.049..0.080 rows=4 loops=9)
复制代码
从A表一次性取9行数据 到服务层,然后循环跟B表做关联? 还是一次从引擎INNODB 取一行数据?
假如是一次性取9行, 那么放在服务层哪个内存里? 服务层哪个内存参数可调整大小?
|