List:MySQL on Win32« Previous MessageNext Message »
From:Guy Gordon Date:June 6 2007 8:34am
Subject:Last Update time of a MyISAM table
View as plain text  
I have an application (written in Delphi) in which I read a small table into an
array for constant access.  At any time (but infrequently) the table might be
updated by a different process.  I want my code to spot this event and reload
the table.  This doesn't have to be done in seconds, but within a few minutes.

I intend to do this;
SQL 'Flush Tables tname1,tname2,tname3'
SQL 'Show Table Status like "tname1"'
if (SavedUpdateTname1<>Row[12]) then ReloadTable1;

I found I have to Flush the tables, or else changes are not reflected in the
Status.  This code will run about every minute or even several times per minute.

1.  Does this look like a reasonable way to accomplish my goal?   

2.  In the Flush Tables documentation there is this cryptic paragraph: FLUSH Syntax
{TABLE | TABLES} [tbl_name [, tbl_name] ...]
When no tables are named, closes all open tables and forces all tables in use to
be closed. This also flushes the query cache. With one or more table names,
flushes only the given tables. FLUSH TABLES also removes all query results from
the query cache, like the RESET QUERY CACHE statement.

I certainly don't want to flush the query cache several times per minute.  Do
the second two sentences above refer to the case "When no tables are named",
or will it also happen when I name a table?

Last Update time of a MyISAM tableGuy Gordon6 Jun