Updating SQL for precomputed tables