With partitioned table, How can I use hints to group each partition separately
2
votes
2
answers
2623
views
Suppose I have the following table
**data(partitioned_key_index, some_dummy_measure)**
Assume that partitions are of an equal large size. with Oracle 11g.
The end result should be like this
select partitioned_key_index, sum(some_dummy_measure)
from data group by partitioned_key_index
Each partition will be grouped independently, the optimizer should be
clever enough to come up with a plan in which each partition will be aggregated then a simple 'union all' to get the desired output.
What I want to do is something close to this
select 1 as partitioned_key_index, sum(some_dummy_measure)
from data where partitioned_key_index = 1
Union All
select 2 as partitioned_key_index, sum(some_dummy_measure)
from data where partitioned_key_index = 2
Union All
.
.
.
select i as partitioned_key_index, sum(some_dummy_measure)
from data where partitioned_key_index = i
My intuition with the above method is to to serialize the hash group operation
thus each partition will be moved from the disk to the buffer cache with the hope of not spilling into disk for the group by operation.
Any ideas how to tune this kind of queries?
Asked by Fadi Bakoura
(169 rep)
Nov 21, 2018, 06:55 PM
Last activity: Sep 10, 2020, 09:55 AM
Last activity: Sep 10, 2020, 09:55 AM