Updating the queries so indexes can be created.