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

Breadcrumb

more

Connor and Chris don't just spend all day on AskTOM. You can also catch regular content via Connor's blog and Chris's blog. Or if video is more your thing, check out Connor's latest video and Chris's latest video from their Youtube channels. And of course, keep up to date with AskTOM via the official twitter account.

Question and Answer

Connor McDonald

Thanks for the question, Pinky.

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

Answered by: Connor McDonald - Last updated: January 13, 2020 - 4:03 am UTC

Category: Database Administration - Version: 12.1.0.2

Viewed 100+ times

Whilst you are here, check out some content from the AskTom team: TOP-N histograms on 12c

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 we 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 ...


and you rated our response

  (1 rating)

Reviews

On Exchange partitions

January 13, 2020 - 7:29 am UTC

Reviewer: Rajeshwaran, Jeyabal

....
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