Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question.

Asked: June 28, 2019 - 7:48 am UTC

Last updated: June 28, 2019 - 3:17 pm UTC

Version: 12c

Viewed 1000+ times

You Asked

Hi Tom,
We have a transaction table storing millions of records. We are planning to create a after-insert trigger on this table which would make an insert to another table for every transaction.
The new table will hold a flag value mentioning if the transaction is in scope for checker process. The reason why we are not adding a new column in the existing table is because it is vendor table and it replicated to our system, so we keep it is its as-is state.
Would there be performance issues since the table is very huge?


and Chris said...

It doesn't matter how many rows there are in the table. What matters is how many rows you add in each insert.

Using compound triggers can help. These allow you to build an array of rows to process in the before/after row blocks.

Then use forall to insert them all in a single after statement call.

For more discussion of these, see:

https://asktom.oracle.com/pls/apex/asktom.search?tag=compound-triggers
https://oracle-base.com/articles/11g/trigger-enhancements-11gr1#compound_triggers

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

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library