Hi John,

----- Original Message -----
From: "John May"
Sent: Sunday, September 14, 2003 7:52 AM
Subject: Initial Table Access Slowness


> I'm noticing that if a table hasn't been used in a while, it takes
> MySQL considerably longer than normal to do the first access of it.
> Once that happens, it's back up to speed.
>
> Any idea on why this happens?  I'm assuming maybe the table file gets
> closed?  Any way to bump up RAM to keep all tables in ram?  Speed up
> the table open/access time?  Etc?

*Assumes you're using MyISAM tables*

If a table is in the table cache and hasn't been used for 15-20 minutes
(in my experience), then yes, it is closed. It will be removed from the
table cache sooner if room is needed for more recently accessed tables
(FIFO - first in, first out). However, I don't think the table needing
to be reopened is a problem for you. Opening a table should be a pretty
fast operation in human terms (few milliseconds at most). Also, when a
table is closed, its key blocks are removed from the key_buffer, which
means they'll need to be read from disk next time (if they're not cached
by the OS). But anyway, what is the size of your table_cache variable?
Also Open_tables and Opened_tables STATUS variables?

Does your system not have much RAM compared to the size of your tables?
(Free RAM actually; e.g. if your key_buffer is too big, there could be
no free RAM for caching file data.) If more data from other tables is
accessed than you have free RAM, any data for this "slow" table that was
cached by the OS (as MySQL itself doesn't cache any data file contents)
will be forced out (again FIFO), causing it to be read from the hard
drive when you access it next time.

So yeah, I would think it's some kind of disk I/O slowdown.

Matt


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to