Refresh MySQL views?

Viewed 25852

At work I'm constantly being told that when changes are made to a MySQL db that the views need to be 'refreshed'. The accepted manual solution seems to be going into Workbench, right clicking, and hitting 'Refresh All'

Is this just meant to be clearing the cache? Or does that rebuild the views from scratch, or is this totally bogus? They seem to be able to tell when views have not been 'refreshed', and I'm not sure they understand it any more than, "Because things need to be refreshed when they are changed."

If it is just clearing the cache, would 'FLUSH TABLES WITH READ LOCK' be enough?

2 Answers

I was working on a project and my view didn't show new data because I was trying to make a join on a NULL field to another table. So I just updated the new data with a correct value for that field and it worked.

Related