Zhuangda Z
06/15/2025, 2:00 PMMayank
Zhuangda Z
06/16/2025, 2:34 AMMayank
Zhuangda Z
06/16/2025, 1:50 PMZhuangda Z
08/03/2025, 3:19 AMMayank
Zhuangda Z
08/03/2025, 2:38 PMMayank
Zhuangda Z
08/03/2025, 3:47 PMMayank
Zhuangda Z
08/03/2025, 3:51 PMType, Latest TS
1, 2024/01/01
2, 2025/01/01Zhuangda Z
08/03/2025, 3:53 PMtype/latest_ts
that would enable better query perfZhuangda Z
08/03/2025, 3:54 PMMayank
Mayank
Zhuangda Z
08/03/2025, 3:55 PMZhuangda Z
08/03/2025, 3:56 PMDo you care about other events of type = 1 which are older than 2024/01/01? If not, that is upsertyes we do. We would need other aggregations too
Mayank
Mayank
Zhuangda Z
08/03/2025, 3:57 PMZhuangda Z
08/03/2025, 3:57 PMtypeZhuangda Z
08/03/2025, 3:59 PMMayank
Mayank
Mayank
Zhuangda Z
08/03/2025, 6:42 PMid, eventType, occurredAt and have rows like:
1, t1, 2024/01/01
2, t2, 2024/02/03
3, t1, 2025/01/01
4, t3, 2025/08/03
5, t4, 2022/01/01
I wanted to query like: show me each event type’s latest occurred ts over the past 2 year window and the expected result would be the following and I would want this query to be performant:
t1, 2025/01/01
t2, 2024/02/03
t3, 2025/08/03Mayank
Zhuangda Z
08/03/2025, 6:43 PMZhuangda Z
08/03/2025, 6:43 PMoccurredAt as a metric column?Zhuangda Z
08/03/2025, 6:44 PMMayank
Mayank
Zhuangda Z
08/03/2025, 6:44 PMproperties, processedAt or textSearchColMayank
Zhuangda Z
08/03/2025, 6:45 PMAnd are you going to do select * on them for the latest timestamp?for this particular case, I would not b/c I only need the latest ts
Mayank
Zhuangda Z
08/03/2025, 6:46 PMMayank
Mayank
Mayank
Zhuangda Z
08/03/2025, 6:49 PM"tableIndexConfig": {
"starTreeIndexConfigs": [{
"dimensionsSplitOrder": [
"eventType"
],
"skipStarNodeCreationForDimensions": [
],
"functionColumnPairs": [
"MAX__occurredAt"
],
"maxLeafRecords": 10000
}],
...
}Mayank
Zhuangda Z
08/03/2025, 6:49 PMMayank
Mayank
Zhuangda Z
08/03/2025, 6:50 PMMayank
Mayank
select eventType, max(occurredAt) as latestTs from table where occurredAt between 20240101 and 20250803 group by eventTypeZhuangda Z
08/03/2025, 6:52 PMMayank
Zhuangda Z
08/03/2025, 6:52 PMeventType, max(occurredAt) nodeMayank
occurredAsMayank
occurredAs will require you to split on it. The moment you split on it, there is no aggregation across rowsZhuangda Z
08/03/2025, 6:53 PMMayank
Zhuangda Z
08/03/2025, 6:54 PMselect eventType, max(occurredAt) as latestTs from table where occurredAt between 20240101 and 20250803 group by eventType
would have to scan through all the matched rows to find out the maxMayank
occurredAtMayank
Mayank
Zhuangda Z
08/03/2025, 7:01 PMoccurredAt filter, would it perform better with ST since it would not have time based prunerMayank
Zhuangda Z
08/03/2025, 7:03 PMZhuangda Z
08/03/2025, 7:03 PMMayank
Mayank
Mayank
Mayank
Zhuangda Z
08/03/2025, 7:06 PMselect eventType, max(occurredAt) as latestTs from table where occurredAt between 20240101 and 20250803 group by eventType
for data
1, t1, 2024/01/01
2, t2, 2024/02/03
3, t1, 2025/01/01
4, t3, 2025/08/03
5, t4, 2022/01/01
and segments are partitioned by a full date. So there would be segments for 2024/01/01, segments for 2024/02/03. Each segment can contain rows across typesZhuangda Z
08/03/2025, 7:06 PMoccurredAtMayank
Mayank
Mayank
Zhuangda Z
08/03/2025, 7:10 PMMayank
Zhuangda Z
08/03/2025, 7:12 PMMayank
select eventType, max(occurredAt) as latestTs from table where occurredAt between 20240101 and 20250803 group by eventTypeZhuangda Z
08/03/2025, 7:14 PMMayank
Zhuangda Z
08/03/2025, 7:15 PMZhuangda Z
08/03/2025, 7:15 PMZhuangda Z
08/03/2025, 7:16 PMMayank
Mayank
it almost seems like a metadata we would need to keep somewhere else
Zhuangda Z
08/03/2025, 7:17 PMZhuangda Z
08/03/2025, 7:20 PMMayank
Zhuangda Z
08/03/2025, 7:21 PMZhuangda Z
08/03/2025, 7:31 PMoccurredAs will require you to split on it. The moment you split on it, there is no aggregation across rows
One quick question about ST index: does it mean the moment we were to filter on a time pruner enabled col, we can’t leverage ST?Zhuangda Z
08/03/2025, 7:32 PMMayank
Zhuangda Z
08/03/2025, 7:46 PMoccurredAt and also have ST index kicked in?Zhuangda Z
08/03/2025, 7:46 PMoccurredAtMayank
Mayank
Mayank
Zhuangda Z
08/03/2025, 7:54 PMZhuangda Z
08/03/2025, 7:56 PMZhuangda Z
08/03/2025, 8:01 PMZhuangda Z
08/03/2025, 8:02 PMAll dictionary-encoded Time/DateTime columns will be appended to the _dimensionsSplitOrder _following the dimensions, sorted by their cardinality in descending order. Here we assume that time columns will be included in most queries as the range filter column and/or the group by column, so for better performance, we always include them as the last elements in the dimensionsSplitOrder.Zhuangda Z
08/03/2025, 8:04 PMZhuangda Z
08/03/2025, 8:13 PM"tableIndexConfig": {
"starTreeIndexConfigs": [{
"dimensionsSplitOrder": [
"eventType",
"occurredAt"
],
"skipStarNodeCreationForDimensions": [
],
"functionColumnPairs": [
"MAX__derivedOccurredAt"
],
"maxLeafRecords": 1
}],
...
}Mayank
Zhuangda Z
08/03/2025, 8:39 PMZhuangda Z
08/03/2025, 8:40 PMMayank
Zhuangda Z
08/03/2025, 8:42 PMZhuangda Z
08/03/2025, 8:42 PMoccurredAt can result in a set of rows to aggregate?Zhuangda Z
08/03/2025, 8:42 PMMayank
Zhuangda Z
08/03/2025, 8:45 PMDefault index generation configuration section, it says:
All dictionary-encoded Time/DateTime columns will be appended to the _dimensionsSplitOrder _following the dimensions, sorted by their cardinality in descending order. Here we assume that time columns will be included in most queries as the range filter column and/or the group by column, so for better performance, we always include them as the last elements in the dimensionsSplitOrder.Mayank
Zhuangda Z
08/03/2025, 8:46 PMMayank
Zhuangda Z
08/03/2025, 8:47 PMMayank
Zhuangda Z
08/03/2025, 8:48 PMMayank
Mayank
Mayank
Mayank
occurredAt, in the leaf there will be only 1 row to aggregateMayank
Mayank
Mayank
Zhuangda Z
08/03/2025, 8:51 PMZhuangda Z
08/03/2025, 8:51 PMMayank
Mayank
Zhuangda Z
08/03/2025, 8:52 PMZhuangda Z
08/03/2025, 8:52 PMMayank
Mayank
Zhuangda Z
08/03/2025, 8:53 PMAll dictionary-encoded Time/DateTime columns will be appended to the _dimensionsSplitOrder _following the dimensions, sorted by their cardinality in descending order. Here we assume that time columns will be included in most queries as the range filter column and/or the group by column, so for better performance, we always include them as the last elements in the dimensionsSplitOrder.Zhuangda Z
08/03/2025, 8:54 PMMayank
Mayank
occurredAt?Zhuangda Z
08/03/2025, 8:57 PMeventType and occurredAtMayank
Zhuangda Z
08/03/2025, 8:58 PM"tableIndexConfig": {
"starTreeIndexConfigs": [{
"dimensionsSplitOrder": [
"eventType",
"occurredAt"
],
"skipStarNodeCreationForDimensions": [
],
"functionColumnPairs": [
"MAX__derivedOccurredAt"
],
"maxLeafRecords": 1
}],
...
}
this is the config I imagineMayank
eventType and occurredAt, how many rows will be there?Zhuangda Z
08/03/2025, 9:00 PMMayank
Mayank
Zhuangda Z
08/03/2025, 9:00 PMMayank
occurredAt value, so they are all MAX?Zhuangda Z
08/03/2025, 9:01 PMAll dictionary-encoded Time/DateTime columns will be appended to the _dimensionsSplitOrder _following the dimensions, sorted by their cardinality in descending order. Here we assume that time columns will be included in most queries as the range filter column and/or the group by column, so for better performance, we always include them as the last elements in the dimensionsSplitOrder.
I think I am still trying to grab the range filter aspect from the above paragraphMayank
Mayank
Mayank
Zhuangda Z
08/03/2025, 9:02 PMMayank
Zhuangda Z
08/03/2025, 9:02 PMMayank
Zhuangda Z
08/03/2025, 9:02 PMZhuangda Z
08/03/2025, 9:03 PMMayank
Zhuangda Z
08/03/2025, 9:04 PMoccurredAtZhuangda Z
08/03/2025, 9:04 PMMayank
Mayank
Zhuangda Z
08/03/2025, 9:04 PMMayank
Mayank
Zhuangda Z
08/03/2025, 9:05 PMMayank
Zhuangda Z
08/03/2025, 9:05 PMZhuangda Z
08/03/2025, 9:05 PMZhuangda Z
08/03/2025, 9:06 PMMayank
occurredAt will by construction prevent pre-aggregation, as I mentioned above.
2. Solution suggested for this case was to create a derived column with lower time granularity (eg days) and use that in the query and split on that in the ST index.
3. This approach allows for multiple rows to be aggregated across 1 day for the same eventType, helping with performance.
4. Independently, we discussed columnValue based pruner to further optimize performance by pruning segments based on the new derived column (for which time pruner won't take effect).Zhuangda Z
08/04/2025, 12:08 AMColumnValueSegmentPruner is enabled by default for serversMayank