global sql optimisations near translation