0

I would like to knew if if possible build a query statement who read the same table from 2 different partition.

In my scenario I have two partition (partition_A and partition_B) and a table "consume" , in nowadays I do this statement :

Select id, item 
From partition_A(consume) 
union all 
Select id, item 
From partition_B(consume);  

but I would like to obtain the same result when I use this statement :

Select id, item from consume;

Is it possible ?

tks.

Anderson Rossi
  • 493
  • 8
  • 21
  • 1
    Are they truly database partitions? if so then the last query should work as the engine shouldn't care about which partition it uses, and should select from both and union the results for you. Now if you just have tables that you've manually partitions... then well don't and use partitions correctly, or create a view with a synonym consume which overrides the schema.consume table name (though not sure it will let you due to duplicate name...) so maybe a view called consume_v which you use instead. – xQbert Jul 18 '17 at 20:06
  • https://stackoverflow.com/questions/19523061/select-from-several-partitions-at-once OR https://stackoverflow.com/questions/24027848/how-to-include-more-than-one-partition-in-a-single-select-statement-in-oracle – xQbert Jul 18 '17 at 20:07

1 Answers1

0

Do you want to like this?

Select id, item 
From consume PARTITION partition_A(name of partition)
union all 
Select id, item 
From consume PARTITION partition_B; 

Maybe I didn't understand your question.

mehmet sahin
  • 802
  • 7
  • 21