What is "normal" performance of the MySQL database?

I have had a hosting account with a company (with good reputaion) which I have been very happy with for several years when using simple php and static html based sites.

However, recently I set up a database (wordpress) site and the performance of database queries seem poor to me (using MySQL).

Since I have no previous experience with databases, I want to check if this really is all that can be expected or if there is likely to be a problem somewhere.

The first access to my site, which according to wordpress means 64 queries to the database, often takes about 10 seconds. Subsequent accesses are then very fast (typically 0.2 seconds or so which include php etc), also to other pages which does different database queries than the first page. So it seems to me there is something slow with the initial connection.

According to my webhost this is because at the first access to the page the database needs to read from disk etc, but in subsequent accesses table-caching provides fast response from the database.

This makes sense, BUT is it really possible that it should take 10 seconds for the database access, even if tables are not in cache?

Some more info:
The load on the the database and the webserver (different machines) is very low, so CPU resources should not be a problem. The database is very little so far. The wordpress site has 9 posts and 9 comments…

Well the caching theory is correct that subsequent queries will be faster.

But 10 seconds sounds very long if the database is small and the servers have very little load.

Have they checked that they don’t have problems with reverse DNS lookups from the mysql server to the web server?

Or if they are using Windows as OS and the two servers aren’t part of the same domain they can have an issue with windows domain authentication which happens implicitly before a tcp connection is established.

sterin, thanks for your answer.

Do you know if there is any easy way I can debug the connection to the database and see what it is that takes time and check about the reverse dns issue etc. My host seems to be happy with the table cache answer, and I don’t think they will do any more investigation. But to me it sound ridiculous if a simple database access should take 10 seconds…

I can access the webserver via ssh, and from there I can connect to the database server with the mysql client.

Good, if you use the mysql frontend on the webserver, how long time does a query like this take:

mysql -u[youruser] -p[yourPassword] -e ‘SELECT 1’ [yourDatabase]

It should return immediately since it doesn’t actually access any table, if it doesn’t then you probably have a problem with the DNS.