Suppose, I have a table
foo, which contains some statistics that are computed every now and then. It is heavily used by other queries.
That's why I want to compute more recent statistics in
foo_new and swap them when computation is ready.
I could do
ALTER TABLE foo RENAME foo_tmp;
ALTER TABLE foo_new RENAME foo;
but what happens if a query needs table
foo inbetween those two lines when there is no table
foo? I guess I have to lock it somehow... or is there another way to do it?