Removing unnecessary load of custom sql