I am using an enterprise application at multiple sites that requires the use of a database. I am not a developer of the application, thus I cannot modify how the application queries the database. Presently, we are trying to migrate from MySQL to PostgreSQL because it happens that the application works better on PostgreSQL.
The application stores data across thousands of tables in a particular database instance. The application has a built-in migration feature that transfers the data from one database vendor (e.g. MySQL) to another. (e.g. PostgreSQL) During the application's migration process, it performs the following two queries for each table in the instance:
SHOW FULL TABLES FROM 'xxx' LIKE 'DATASERIES_yyy'
SELECT COUNT(1) FROM 'DATASERIES_yyy'
Where 'xxx' is the database instance and 'yyy' is an arbitrary, non-sequential integer.
Each of the above queries is run on each 'DATASERIES_yyy' table before data migration actually begins. The process of running the above two queries is by FAR the largest bottleneck of the migration process. I see from MySQL's Information Schema that running the above two queries takes on average .25 seconds to complete, and the majority of that time is spent on 'Checking Permissions'. This is true for powerful servers or even my modest work laptop.
I have scoured the internet for ways that might improve the performance of these two queries. Because I can't modify the way the application queries the database, I am only able to focus on MySQL itself.
Things I have attempted to speed them up: 1. Ensured innodb_stats_on_metadata is off. 2. Set innodb_read_io_threads = 64. 3. Ensured query caching is turned off. 4. Removed all users except the 1 user name the application uses to log in to the database. 5. Set query_cache_type = 0. 6. Set innodb_io_capacity = 1000. 7. Buffer Pools have been configured to use about 70% of server memory long ago.
I am not expecting any miracles, but are there other things I can try to help this process speed up?
Because the MySQL database will be discarded after the migration is complete, I am able to use non-traditional settings just to get the process going faster, so feel free to make recommendations that would be considered temporary or short-term. (Obviously, data integrity can't be compromised.)
BTW, I know I can't use innodb_read_only because the application writes four UPDATES at the beginning of the process and DELETEs them at the end so that it knows the process began and ended correctly.
These sites are all MySQL instances running in Windows Environments. Most sites are running MySQL versions 5.7. The others are 5.5.
Any guidance appreciated. Thank you!
Edit: 1. User permissions are set globally, not per table. 2. It is not at all untypical for there to be 10,000 of the 'DATASERIES_yyy' tables. 3. Yes, the underscore is in the 'DATASERIES_yyy' table name. I have no control over the naming of the tables.