How to Write Better Queries for Time-Series Data Analysis With Custom SQL Functions | TigerData