patternsqlMinor
Can SHOW TABLE STATUS query performance on MySQL be improved ? - Amazon RDS
Viewed 0 times
showcanimprovedquerystatusmysqlamazonperformancerdstable
Problem
I have a fairly large database on the Amazon Relational Database Service (RDS) running on MySQL 5.1.57. There are 900+ tables, so that running the "SHOW TABLE STATUS" query can take up to 30 seconds.
We have an integration with the UPS Worldship software connecting through ODBC. It seems that this software running the
My questions are these:
We have an integration with the UPS Worldship software connecting through ODBC. It seems that this software running the
SHOW TABLE STATUS; query before every function, such that clicking a button requires a 45 second wait. We had the same database running prior to the new year on dedicated hardware, and we didn't have this problem.My questions are these:
- Is there a way to improve the performance of this query ?
- What might be causing such a problem ?
Solution
You may want to disable the variable innodb_stats_on_metadata.
According to the MySQL Documentation on
When this variable is enabled (which is the default, as before the
variable was created), InnoDB updates statistics during metadata
statements such as SHOW TABLE STATUS or SHOW INDEX, or when accessing
the INFORMATION_SCHEMA tables TABLES or STATISTICS. (These updates are
similar to what happens for ANALYZE TABLE.) When disabled, InnoDB does
not update statistics during these operations. Disabling this variable
can improve access speed for schemas that have a large number of
tables or indexes. It can also improve the stability of execution
plans for queries that involve InnoDB tables.
Since you are using Amazon RDS, ask your DB Administrators to disable it. If your DBs are in a Shared Resource, my condolences...
UPDATE 2012-07-25 14:45 EDT
If you can download the RDS CLI, you can adjust
Since Amazon RDS does not give away SUPER privilege, that's the only way to change a GLOBAL static option.
UPDATE 2012-07-27 16:34 EDT
Without SUPER Privilege, you can modify a DB Parameter Group for a given MySQL RDS Instance, and launch a reboot with one of the following:
According to the MySQL Documentation on
innodb_stats_on_metadataWhen this variable is enabled (which is the default, as before the
variable was created), InnoDB updates statistics during metadata
statements such as SHOW TABLE STATUS or SHOW INDEX, or when accessing
the INFORMATION_SCHEMA tables TABLES or STATISTICS. (These updates are
similar to what happens for ANALYZE TABLE.) When disabled, InnoDB does
not update statistics during these operations. Disabling this variable
can improve access speed for schemas that have a large number of
tables or indexes. It can also improve the stability of execution
plans for queries that involve InnoDB tables.
Since you are using Amazon RDS, ask your DB Administrators to disable it. If your DBs are in a Shared Resource, my condolences...
UPDATE 2012-07-25 14:45 EDT
If you can download the RDS CLI, you can adjust
innodb_stats_on_metadata in a customized DB Parameter Group. You will have to do the following:- mysqldump data out of RDS Server
- destroy DB Server Instance
- create DB Server Instance using your custom DB Parameter Group adjusted for
innodb_stats_on_metadata
- reimport the mysqldump into new DB Instance
Since Amazon RDS does not give away SUPER privilege, that's the only way to change a GLOBAL static option.
UPDATE 2012-07-27 16:34 EDT
Without SUPER Privilege, you can modify a DB Parameter Group for a given MySQL RDS Instance, and launch a reboot with one of the following:
rds-reboot-db-instance
- Click Reboot Button in the RDS Management Console
Context
StackExchange Database Administrators Q#13999, answer score: 4
Revisions (0)
No revisions yet.