Bug #9184 | slow log listing incorrect value for Rows_Examined | ||
---|---|---|---|
Submitted: | 15 Mar 2005 4:58 | Modified: | 19 Jul 2005 13:09 |
Reporter: | Matthew Lord | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | all | OS: | all ? |
Assigned to: | Mark Matthews | CPU Architecture: | Any |
[15 Mar 2005 4:58]
Matthew Lord
[15 Mar 2005 23:36]
Matthew Lord
I tested this with 4.0.24 on x86 linux with the same results.
[28 Mar 2005 17:48]
MySQL Verification Team
I was able to repeat using the debug server and the machine under high load for to get a query ~2 seconds. Time Id Command Argument mysqld-debug, Version: 4.1.11-debug-log. started with: Tcp port: 3306 Unix socket: MySQL Time Id Command Argument # Time: 050327 14:44:11 # User@Host: root[root] @ localhost [127.0.0.1] # Query_time: 2 Lock_time: 0 Rows_sent: 50 Rows_examined: 49446 use t; SELECT SQL_CALC_FOUND_ROWS m.USER_CREATED AS USER_CREATED, m.ID AS ID,
[19 Apr 2005 19:43]
Ingo Strüwing
The factor of three times row count results from the ORDER BY clause. First, all rows from LISTING are read to collect the sort keys. Then every row from LISTING is read and the corresponding row from JOB_LISTING is fetched by key. Now my question is: what is the bug to be fixed?
[19 Apr 2005 19:56]
Matthew Lord
Hi Ingo, The Rows_Examined value should indicate how many rows from table A need to be read, not how many times those rows are examined. It makes no logical sense to have Rows_Examined for a table higher than the number of rows. I'll also note that I have not noticed this behavior before on any queries of a similar type. You are saying that every time a SELECT is done that joins tables together and orders the results, the Rows_Examined for the first table will be multiplied by the number of tables joined? I have not noticed this before.
[19 Apr 2005 20:00]
Matthew Lord
Another note: I haven't noticed this before because I'm typically using EXPLAIN to see how many Rows_Examined would be for a query. The EXPLAIN output is correct IMO for the query mentioned in the bug report. Why would a different value be used in the slow log output? Why wouldn't they at least be consistent one way or the other? Best Regards
[20 Apr 2005 20:26]
Ingo Strüwing
In my opinion, EXPLAIN shows an estimate of rows to be looked at by each key and condition. 'Rows_examined', however, counts every access of a row exactly. This cannot be known in advance. There might be many cases where these values match. But in general they don't. If you want to have these values the same, then please ask Brian to assign the bug to someone who can make such not-so-minor design decisions. Best regards.
[19 May 2005 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".