improved speed of cooking sql