This is an automated archive.

The original was posted on /r/mysql by /u/Schweppeslul on 2023-12-02 00:20:25+00:00.


If you use the explain statement how do you calculate the total number of rows searched?

the query

select * from
(
select * from customers1
) as temp1
inner join
(
select * from customers2
) as temp2 ON temp1.customer_id = temp2.customer_id
where temp1.age != temp2.age or temp1.type != temp2.type;

with explain:

id  table       type    rows   extra
1   derived      ALL     10
1   derived      ref     2     Using where
3   customer1    ALL     20
2   customer2    ALL     10

Do you multiply the ALL statements and add the ref?