Hi Pinot Community! :wave: We are refining our qu...
# troubleshooting
p
Hi Pinot Community! 👋 We are refining our query standards to ensure we avoid implicit casting and leverage indexes properly. Consider this example of column my_timestamp_col of type TIMESTAMP
Copy code
WHERE my_timestamp_col > '2025-11-02T00:00:00+01:00‘
This syntax works but it takes a very long time. I am assuming either Pinot is implicitly casting my_timestamp_col to string and doing string comparison or indexes are getting ignored due to type mismatch. When we convert our datetime string to TIMESTAMP type exactly, our query performance improves significantly. However, I’m curious which of these three approaches is recommended for filtering TIMESTAMP columns, especially regarding the Multi-Stage Engine: Option A (ANSI SQL CAST):
Copy code
WHERE my_timestamp_col > CAST('2025-11-02T00:00:00+01:00' AS TIMESTAMP)
Option B (Explicit Functions):
Copy code
WHERE my_timestamp_col > toTimestamp(fromIso8601('2025-11-02T00:00:00+01:00'))
Option C (Standard Literal - This does not support timezones - UTC only ):
Copy code
WHERE my_timestamp_col > TIMESTAMP '2025-11-02 00:00'
Our specific questions: Performance: Is any one of these more "index-friendly" than the others? Timezones: Does CAST (Option A) reliably handle the +01:00 offset, or should we stick to fromIso8601 (Option B) for anything non-UTC? Engine Preference: With the move toward the Multi-Stage Engine, is there a preferred syntax for long-term compatibility? (we only use multi stage engine) Would love to hear your thoughts on the "cleanest" way to handle this in production. Thanks!
x
literal only function will be evaluated at query compilation time, so if you know the converted value is epoch value, then perf should be the same. You can explain the query and see what’s the literal value in the filter expression
p
Thanks! I ran explain plan for the queries. TIMESTAMP‘yyyy-MM-dd HH:mm‘ syntax still kept the literal as string toTimestamp(fromIso8601() and CAST(string as TIMESTAMP) converted them to epoch properly. We will then stick to these two
👍 1