Yusuf Külah
02/26/2025, 12:49 PMtimestamp and pid . When I run
explain plan for
select cid, pid, count(cid) as volume
from test_table
where UTCTimestamp > ago('PT30M') and pid < 150 and pid > 100
group by cid, pid
having count(cid) > 10
order by volume desc
sometimes it uses range-index,
FILTER_RANGE_INDEX(indexLookUp:range_index,operator:RANGE,predicate:UTCTimestamp > '1740503053957')
FILTER_RANGE_INDEX(indexLookUp:range_index,operator:RANGE,predicate:(pid > '41000' AND pid < '41050'))
sometimes it adds full scan to the plan
FILTER_FULL_SCAN(operator:RANGE,predicate:UTCTimestamp > '1740502920093')
FILTER_FULL_SCAN(operator:RANGE,predicate:(pid > '100' AND pid < '150'))
what can be a possible cause for the same input but different output from broker ?Bolek Ziobrowski
02/26/2025, 1:36 PMYusuf Külah
02/26/2025, 1:50 PMYash Mayya
02/26/2025, 1:53 PMYash Mayya
02/26/2025, 1:54 PMYusuf Külah
02/26/2025, 1:55 PM{
"columns": [
"Operator",
"Operator_Id",
"Parent_Id"
],
"records": [
[
"BROKER_REDUCE(havingFilter:count(cid) > '1000',sort:[count(cid) DESC],limit:1000)",
1,
0
],
[
"COMBINE_GROUP_BY",
2,
1
],
[
"PLAN_START(numSegmentsForThisPlan:24)",
-1,
-1
],
[
"GROUP_BY(groupKeys:cid, pid, aggregations:count(*))",
3,
2
],
[
"PROJECT(templateInstanceVersion, templateInstanceId, pid, cid)",
4,
3
],
[
"DOC_ID_SET",
5,
4
],
[
"FILTER_AND",
6,
5
],
[
"FILTER_FULL_SCAN(operator:RANGE,predicate:(pid > '41000' AND pid < '41050'))",
7,
6
],
[
"FILTER_FULL_SCAN(operator:RANGE,predicate:UTCTimestamp > '1740506493999')",
8,
6
],
[
"PLAN_START(numSegmentsForThisPlan:2545)",
-1,
-1
],
[
"GROUP_BY(groupKeys:cid, pid, aggregations:count(*))",
3,
2
],
[
"PROJECT(templateInstanceVersion, templateInstanceId, pid, cid)",
4,
3
],
[
"DOC_ID_SET",
5,
4
],
[
"FILTER_AND",
6,
5
],
[
"FILTER_RANGE_INDEX(indexLookUp:range_index,operator:RANGE,predicate:(pid > '41000' AND pid < '41050'))",
7,
6
],
[
"FILTER_RANGE_INDEX(indexLookUp:range_index,operator:RANGE,predicate:UTCTimestamp > '1740506493999')",
8,
6
]
]
}
If you track operator number 7 and 8, it is marked as both full scan and range index.Yusuf Külah
02/26/2025, 1:55 PMYash Mayya
02/26/2025, 1:57 PMoh, is it running full scan on consuming segments and using range index on comitted segments ?Yeah, that's my theory
Yash Mayya
02/26/2025, 1:58 PMPLAN_START(numSegmentsForThisPlan:24)
PLAN_START(numSegmentsForThisPlan:2545)
Do you have 24 consuming segments in that table and 2545 committed segments? If yes, that would confirm the theory.Yusuf Külah
02/26/2025, 1:59 PMYash Mayya
02/26/2025, 1:59 PMYash Mayya
02/26/2025, 2:00 PM• given predicate will be satisfied by all rows in a given segment, it might remove them from segment's planIn this case, we would've seen
FILTER_MATCH_ENTIRE_SEGMENT in the plan I believe.Yusuf Külah
02/26/2025, 2:05 PMFILTER_MATCH_ENTIRE_SEGMENT(docs:2911586)