Hi I am running a query that has the following fil...
# troubleshooting
s
Hi I am running a query that has the following filter condition
FROM
testsignupinfo3
WHERE
"eventtime" BETWEEN CAST('2024-06-01 00:00' AS TIMESTAMP) AND CAST('2024-06-30 23:59' AS TIMESTAMP)
GROUP BY
"channel"
I had first run the query on a table without timestamp indexes.And then on a table with indexes.The query performance in both cases are the same. I have included the following in my table config
"tableIndexConfig" : {
"invertedIndexColumns" : ["eventnumber","isbounce"],
"loadMode"  : "MMAP",
"rangeIndexVersion": 2,
"rangeIndexColumns": ["eventtime"]
},
{
"name": "eventtime",
"encodingType": "DICTIONARY",
"indexTypes": ["TIMESTAMP"],
"timestampConfig": {
"granularities": [
"MILLISECONDS",
"DAY",
"WEEK",
"MONTH"
]
}
}
Will this improve the time efficiency only if i couple it with datetrunc functions.Or will the index on the "eventtime" column help even if the query has a range filter?
x
use
dateTimeConvert
function for
STRING
to
TIMESTAMP
convert?
timestamp index help when you use it with
dataTrunc
function
s
if i do not use date trunc function in my queries , will range index help for this type of filter
WHERE
"eventtime" BETWEEN CAST('2024-06-01 00:00' AS TIMESTAMP) AND CAST('2024-06-30 23:59' AS TIMESTAMP)
and i am currently using multi stage engine so i will not be able to use the timestamp index
are range indexes supported for multi stage engine?
x
Yes, range index will help
Just be aware that pinot index is local to the segment, so if your single segment would have data span across multiple days or months then you will get benefit
otherwise the query will match the entire segment, then no index is needed.
s
oh okay.I have two segments .Each segment contains data for one month.(With little overspill of neighbouring months data) .In that case, if i am i use a range filter for each month in my query , the entire segment is scanned for each month respectively.So in that case the query will show the same performance with and without the range index.Am i right?
x
correct
I would prefer to have daily segment
s
i dont quite understand,how will daily segments help to increase efficiency with range queries?
x
you will filter less data cause the 29 days are within the predicate and you only need to deal with the 2 boundary days, so you are scanning at most 32 days data
if you have monthly data, then you are optimizing how to filter less for 3 month of data
Assume you are querying 30 days of data
note that pinot has time based pruning if you are querying the timestamp pinot could prune segment based on metadata start/end time
s
oh ok ...Thanks @Xiang Fu