Inspecting indexes and triggers overhead
In this recipe we will see the overhead introduced by indexes and triggers on DML operations. We will explore alternative ways to implement calculated fields using virtual columns instead of triggers.
How to do it...
The following steps will demonstrate the index and trigger overheads:
- Connect to the
SH
schema:CONNECT sh@TESTDB/sh
- Create an empty table
MY_CUSTOMERS
, copying theCUSTOMERS
table structure:CREATE TABLE MY_CUSTOMERS AS SELECT * FROM CUSTOMERS WHERE ROWNUM < 1;
- nsert all of the records from
CUSTOMERS
toMY_CUSTOMERS
, measuring time:SET TIMING ON INSERT INTO MY_CUSTOMERS SELECT * FROM CUSTOMERS; SET TIMING OFF
- Truncate the
MY_CUSTOMERS
table:TRUNCATE TABLE MY_CUSTOMERS;
- Add a unique index and ...
Get Oracle Database 11gR2 Performance Tuning Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.