Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm reviewing the slow log, and on one of my slaves the average time for SHOW GLOBAL STATUS is 914s.

Any idea how to determine the cause of this?

share|improve this question
    
what was the load avg, IO, wait, idle details before/when/after you issue that command on slave. –  Mannoj Jun 10 '13 at 6:53
    
@Mannoj: I don't have that information- I was seeing this in the slow query log. –  chris Jun 10 '13 at 22:48
    
You said average time for show global status; is 15 mins. Did you try executing the command in the console manually in frequent intervals? Try to audit slow query log info and server monitoring metrics during the test. –  Mannoj Jun 11 '13 at 7:02
add comment

1 Answer

That sounds very unusual, but not surprising. All it takes to run SHOW GLOBAL STATUS; is the USAGE privilege, which is just general connectivity as stated in the last sentence of the first paragraph of the MySQL Documentation on SHOW STATUS:

This statement does not require any privilege. It requires only the ability to connect to the server.

Given these facts, there can only be two possible causes:

POSSIBLE CAUSE #1

In MySQL 5.1 and MySQL 5.5, values for global status are accessible via the INFORMATION-SCHEMA database

Here is the table layout:

mysql> show create table information_schema.global_status\G
*************************** 1. row ***************************
       Table: GLOBAL_STATUS
Create Table: CREATE TEMPORARY TABLE `GLOBAL_STATUS` (
  `VARIABLE_NAME` varchar(64) NOT NULL DEFAULT '',
  `VARIABLE_VALUE` varchar(1024) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

Notice it is a MEMORY table. Like MyISAM, all INSERTs, UPDATEs, and DELETEs into a MEMORY table require a full table lock (See Locking Granularity for MEMORY Storage Engine). There has to be some intermittent lock to populate values into this table. Since this table is local to the DB Connection, only the DB Connection is affected.

POSSIBLE CAUSE #2

User authentication may be blocked for a time due to host caching and DNS. Note paragraph 2 the MySQL Documentation on DNS Lookup Optimization and the Host Cache:

For each new client connection, the server uses the client IP address to check whether the client host name is in the host cache. If not, the server attempts to resolve the host name. First, it resolves the IP address to a host name and resolves that host name back to an IP address. Then it compares the result to the original IP address to ensure that they are the same. The server stores information about the result of this operation in the host cache.

If you do not have skip-host-cache and skip-name-resolve configured, please add these to my.cnf:

[mysqld]
skip-host-cache
skip-name-resolve

and restart mysql ASAP.

EPILOGUE

Cause #2 is a bit of a stretch since authentication should not trigger an entry into the slow query log.

Cause #1 is a lot more likely because if the global status is being loaded into a table, it is an SQL query with discernible passage of time.Thus, if the query's running time (in seconds) exceeds long_query_time, it will get recorded into the slow query log.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.