-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
I have a query as follows:
select count(*) from githubEvents where dateTrunc('YEAR', event_time) = '2016-01-01 00:00:00.0'
It produces a nonzero result:
| count(*) |
|---|
| 323650488 |
However, when I try an explain plan:
explain plan for select count(*) from githubEvents where dateTrunc('YEAR', event_time) = '2016-01-01 00:00:00.0'
The query plan picks a segment at random which should have been pruned, and doesn't reflect the way the query is evaluated:
| Operator | Operator_Id | Parent_Id |
|---|---|---|
| BROKER_REDUCE(limit:10) | 0 | -1 |
| COMBINE_AGGREGATE | 1 | 0 |
| FAST_FILTERED_COUNT | 2 | 1 |
| FILTER_EMPTY | 3 | 2 |
It would be helpful if the plan chose a segment which has data, or queried all segments and merged operators when the operator varies according to segment.