How to Find the Last Accessed Date of a MySql Database

How to Find the Last Accessed Date of a MySql Database

am 01.02.2008 12:05:01 von mosesdinakaran

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

Re: How to Find the Last Accessed Date of a MySql Database

am 01.02.2008 13:13:42 von colin.mckinnon

On 1 Feb, 11:05, "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.

Re: How to Find the Last Accessed Date of a MySql Database

am 01.02.2008 13:36:43 von Jerry Stuckle

C. (http://symcbean.blogspot.com/) wrote:
> On 1 Feb, 11:05, "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.
>

None of which will give you correct information.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: How to Find the Last Accessed Date of a MySql Database

am 01.02.2008 13:37:07 von Jerry Stuckle

mosesdinakaran@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
>

What does this have to do with PHP? Maybe you should be asking in a
MySQL newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================