List:General Discussion« Previous MessageNext Message »
From:Shawn Green (MySQL) Date:January 12 2011 5:28pm
Subject:Re: Which row in which table has been accessed at which time?
View as plain text  
On 1/12/2011 10:26, mysql wrote:
> Hi listers
> I have a mysql web application. in this application it would be fine to
> be able to track the database entries i have visited, because often
> later on i grat my head: which entry did i see this already in?
> So i would need a way to find out which entries in which table i have
> visited lately.
> i first created a last_access table column and updated it before
> selecting the table entry, but alas, this way i also updated the
> last_update entry of the table which has "on update current_timestamp".
> it can't be done this way.
> i also looked for an "on select" event in mysql, but i was not sucessful.
> also, the "show status" command was not helpful.
> the complicated way would be to create a special table and make entries
> into it whenever i access entries in different tables.
> when googling around i found, it is even not easy to find out, which
> tables have been accessed in general. if, now, i want to know even which
> row in a particular table has been accessed at which time, the problem
> gets even more difficult.
> does anybody have a solution to this, which is easier than the
> complicated way mentionned earlier?
>
> thanks for any hints.
>
> suomi
>

It may be possible for some kind of client program to keep track of 
which queries you executed but it is not practical at all for any 
database system to record every access to every row if you expect any 
sort of reasonable performance.  Some very high-security situations can 
be configured to do that but it *seriously* degrades performance to do 
that much extra logging.

This is also not a behavior that MySQL can provide without some major 
custom engineering. The closest sort of log we can provide to you for 
that kind of tracing is the General Query Log
http://dev.mysql.com/doc/refman/5.5/en/query-log.html

Yours,
-- 
Shawn Green
MySQL Principal Technical Support Engineer
Oracle USA, Inc.
Office: Blountville, TN
Thread
Which row in which table has been accessed at which time?mysql12 Jan
  • Re: Which row in which table has been accessed at which time?Martijn Tonies12 Jan
  • Re: Which row in which table has been accessed at which time?MySQL)12 Jan
  • Function QuestionNicholas Moreno12 Jan
    • Re: Function Questionmos12 Jan