I am creating a chat program in php. Each client in the chat will make periodic queries to mysql to retrieve possible new messages.
The downside to this is the high overhead involved at times when no new messages are available.
One idea I have about that is to create a 0 byte file at the beginning of the chat, then use touch() to update the "modification time" each time an INSERT is done on mysql. A different script will then use filemtime() to see if the time has changed, and if so, only then will a SELECT be done on mysql.
My question then is this: is this a good idea? Is the use of touch() together with filemtime() more expensive than just reading mysql?
Thanks.
Richie.