Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> My weekly tip: massive insert and update

My weekly tip: massive insert and update

From: Juan Cachito Reyes Pacheco <jreyes_at_dazasoftware.com>
Date: Mon, 15 Mar 2004 17:12:11 -0400
Message-ID: <002401c40ad2$644e00a0$2501a8c0@dazasoftware.com>


Hi I had to optimize massive insert and deletes, but the most interesting and curuious I
found is, after optimizing a process using bulk inserts, this took slightly more time,
but the statpacks reports, show this was using less cpu, etc, all was optimal.

Looking at tom site, I found a similar situation, a update that took more time, but it
was using less resources, and Tom Kyte showed it was better. http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:6407993912330

It's curious, because I always thought that a tunned should always be faster, but
it seems there are exceptions

Here is the text I got, I hope this could be helpfull to someone

1.1.1              Faster Updates
1)       If you are executing millions of updates a better option can be
create table2 as select … from table1;
drop table table1;
rename table2 to table1
add indexes and constraints;

You additionally use nologging tables(avoid redo generation) and append hint(avoid undo generation), but you must be aware about the consequences explained in “Faster Inserts”.

2)If you know several rows has the new value you want to set, do the following

UPDATE TABLE SET COLUMN=’VALUE’ WHERE NOT COLUMN=’VALUE’; 1.1.2 Faster Inserts
1) To execute several inserts, deletes or updates you can disable the logging, this means you will have to do a full back up after that, because it eliminates redo generation, needed for backups in archivelog mode.

You can do directly in the table

ALTER TABLE ADM.ANF_RATIOS_ME NOLOGGING; 2) insert /*+ append */ into…, remember indexes will save log information.

, this bypasses undo generation, your table will have to be commit, before issuing this command and after issuing if you want to access it again.

This is completely safe.

3) Analyze the use of import or load utilities to load that table or data, usually is the fastest.

4) When you have to insert (if not exists) and update if it exists you can use MERGE command

5) If you are using loops, to insert data, use bulk collect.



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--

Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
Received on Mon Mar 15 2004 - 15:14:01 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US