Bug #5879 Fix for Examined_rows in UNION's with 4.0
Submitted: 4 Oct 2004 15:04 Modified: 5 Oct 2004 13:54
Reporter: Sinisa Milivojevic
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:4.0 OS:Any (Any)
Assigned to: Sinisa Milivojevic Target Version:

[4 Oct 2004 15:04] Sinisa Milivojevic
Description:
When slow query log is enabled, number of examined rows is wrongly reported with UNION's
are used.

Instead of total number of examined rows, only rows from temporary tables are reported. 

How to repeat:
create table foo (id int(11));
insert into foo values (1),(2),(3),(4);
Turn on slow query logging in the long format, with:

--log-slow-queries --log-long-format

select count(*) from foo a, foo b, foo c where a.id=1;

select count(*) from foo a, foo b, foo c where a.id=1 union select count(*) from foo a,
foo b, foo c where a.id=1;

drop table foo;

First entry will have many examined rows while second will have zero rows reported.