Bug #42786 quan displays wrong database for queries
Submitted: 12 Feb 2009 10:32 Modified: 22 Jul 2009 11:00
Reporter: Daniel Fischer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: MC Brown CPU Architecture:Any
Tags: mem_discuss_me

[12 Feb 2009 10:32] Daniel Fischer
Description:
The query analyzer view will show the wrong database for queries that were executed against a different database that the one currently selected.

use foo;
SELECT 1 FROM bar.baz LIMIT 1;

Will show up as accessing database `foo` while it really only accesses `bar`.

How to repeat:
See above.
[12 Feb 2009 10:55] Sveta Smirnova
Thank you for the report.

Verified as described. although this is consistent with how other MySQL program work (for exampe, mysqld with --binlog-do-db option). So probably only remark in the documentation needed.
[18 Feb 2009 22:36] Mark Leith
The Database column that we show on the QUAN page is actually the "default" database, we do not do any statement parsing to determine the databases used to show on the main page (or anywhere else yet in fact) - this is "as designed". 

It should be clearly documented that the Database column in the Query Analysis page is the "default" database for the connection at the time the statement was executed. 

Now, if you would like to search for queries against a distinct database, you can also use a regex search of the query string (the first two filter inputs). If we don't have it documented already, it would be nice to use this as an example for searching statements. 

Cheers,

Mark
[24 Feb 2009 9:43] Daniel Fischer
In this application, I have several joins that span multiple databases. It's not an unusual scenario: One database belongs to the application core, the other belongs to an independent module.

Would it be possible to show all databases used by a query instead of the default database?
[22 Jul 2009 11:00] Enterprise Tools JIRA Robot
Martin MC Brown writes: 
I've updated the notes in the Quan section to point out that this is the default DB, not the DB necessarily quoted in the query.