Posted by C. (http://symcbean.blogspot.com/) on 02/01/08 12:13
On 1 Feb, 11:05, "mosesdinaka...@gmail.com" <mosesdinaka...@gmail.com>
wrote:
> Hi All,
>
> How to find out the last accessed date of a MySql Database.
>
> I have around 200 databases in my server some are used and some are
> not in Use, I want to remove the database that are not in Use.
>
> SHOW TABLE STATUAS gives me last updated Date.
>
> In my case there are some database which are not updated at all, but
> it is in use (ie only SELECT no UPDATE)
>
> So Is there a way to get the datetime of the last SELECT query that is
> being execued in a Database.
>
> Thanks
> Moses
You could check the access time on the database file (assuming its
sitting on a *nix/Linux box). But that might be changed by other
things (particularly stopping/starting the database and of course
backups).
You *could* get the last query from the slow queries log by setting
the threshold to 0 but IIRC this is for the whole DBMS and it'd be
difficult to discriminate between tables with the same name in
different databases.
Otherwise I guess you'd have to reconcile the apache access log with
the tables.
C.
[Back to original message]
|