Below is the list of changes that have just been committed into a local
5.0 repository of tnurnberg. When tnurnberg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-11-02 15:59:34+01:00, tnurnberg@stripped +1 -0
Bug#31700: thd->examined_row_count not incremented for 'const' type queries
UNIQUE lookups are a special case in do_select() and don't go through the
code-path that normally does the row-counting. CS adds counting to that
case.
No test case as issue shows only in slow query log and other counters can
give subtly different values (with regard to counting in create_sort_index(),
synthetic rows in ROLLUP, etc.).
sql/sql_select.cc@stripped, 2007-11-02 15:59:32+01:00, tnurnberg@stripped +12 -0
Don't forget const tables when counting read records!
diff -Nrup a/sql/sql_select.cc b/sql/sql_select.cc
--- a/sql/sql_select.cc 2007-10-23 15:48:56 +02:00
+++ b/sql/sql_select.cc 2007-11-02 15:59:32 +01:00
@@ -10339,6 +10339,18 @@ do_select(JOIN *join,List<Item> *fields,
error= (*end_select)(join,join_tab,0);
if (error == NESTED_LOOP_OK || error == NESTED_LOOP_QUERY_LIMIT)
error= (*end_select)(join,join_tab,1);
+
+ /*
+ Count up examined_rows if key matches, no matter whether we
+ actually got to send the record in end_send() (due to HAVING
+ excluding it, failures, LIMIT, ...).
+ Make sure we count up row_count after the fact, otherwise any
+ warnings will contain row numbers that are off by one.
+ join->send_records is increased on success in end_send(), so
+ we don't touch it here.
+ */
+ join->examined_rows++;
+ join->thd->row_count++;
}
else if (join->send_row_on_empty_set())
{