Skip to Main Content
  • Questions
  • how to insert millions of records may be more in partitions.

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Pinky.

Asked: January 10, 2020 - 9:29 pm UTC

Last updated: January 13, 2020 - 4:03 am UTC

Version: 12.1.0.2

Viewed 1000+ times

You Asked

how to insert millions of records may be more in partitions.

select partition_name, compression, num_rows / nullif(blocks,0) rows_per_blk
from dba_tab_partitions
where table_name = 'SALES_P'
order by partition_position; 2 3 4

PARTITION_NAME COMPRESSIO ROWS_PER_BLK
-------------------- ---------- ------------
SALES_P_JAN ENABLED
SALES_P_FEB ENABLED
SALES_P_MAR ENABLED
SALES_P_DEC ENABLED


This is my table (sales_p) with 4 partitions , i need to insert millions of rows in each one
please send me any sql code to do to so.

and Connor said...

Am I missing something obvious here? Isn't this just


insert into sales_p partition ( SALES_P_JAN  )
select ...

insert into sales_p partition ( SALES_P_FEB )
select ...

insert into sales_p partition ( SALES_P_MAR )
select ...

insert into sales_p partition ( SALES_P_DEC )
select ...


Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

On Exchange partitions

Rajeshwaran, Jeyabal, January 13, 2020 - 7:29 am UTC

....
insert into sales_p partition ( SALES_P_JAN )
select ...
....


If the result set to be loaded in a partition - exists completely in another table - then Exchange partition would be a way to go then the above insert statements, (just swapping the extents between the segments)

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database