Slice SQL queries when using the API