Thread: Which nologging way is better for performance?

This question is not answered. Helpful answers available: 5. Correct answers available: 1.


Permlink Replies: 14 - Pages: 1 - Last Post: Jul 9, 2009 7:31 AM Last Post By: Randolf Geist
jetq

Posts: 923
Registered: 11/24/06
Which nologging way is better for performance?
Posted: Jul 8, 2009 2:01 PM
 
Click to report abuse...   Click to reply to this thread Reply
Which nologging way is better for performance?
I want to use a procedure P to insert the data into table T repeatedly.
The application does not care if the data is lost or not after the data is inserted into the table because all the data is temp data. So I choose nologging fashion to insert data. Which way is beter for performance?
1. Using nologging command in in the definition of table T .
2. Using nologging command in the procedure P.(or /*+ append */ hint. )
3. using direct insert.
sb92075

Posts: 2,580
Registered: 06/27/99
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 2:05 PM   in response to: jetq in response to: jetq
 
Click to report abuse...   Click to reply to this thread Reply
the data is inserted into the table because all the data temp data.
Won't happen in a well architected Oracle DB.
It is past time to leave MYSQL or MS SQLServer mentality in the trash heap.
jetq

Posts: 923
Registered: 11/24/06
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 2:17 PM   in response to: sb92075 in response to: sb92075
 
Click to report abuse...   Click to reply to this thread Reply
It is a spacial application and it don't care the data lost.
Another question: Is the indexes of this table updated correspondingly using these nologging insert methods?
Justin Cave

Posts: 24,001
Registered: 10/11/99
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 2:53 PM   in response to: jetq in response to: jetq
 
Click to report abuse...   Click to reply to this thread Reply
If the data is truly temporary, is the table defined as a global temporary table?

Justin
SomeoneElse

Posts: 9,551
Registered: 10/15/98
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 2:54 PM   in response to: jetq in response to: jetq
 
Click to report abuse...   Click to reply to this thread Reply
3. using direct insert.

What exactly do you mean by this?
Taral Desai

Posts: 90
Registered: 08/26/07
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 3:05 PM   in response to: jetq in response to: jetq
 
Click to report abuse...   Click to reply to this thread Reply
Depends on load. If loading less data won't make much difference.

# 1 Will not recover data in case of lose
# 2 & 3 are same isn't it ?
Jesus Sanchez

Posts: 1
Registered: 07/08/09
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 3:41 PM   in response to: Taral Desai in response to: Taral Desai
 
Click to report abuse...   Click to reply to this thread Reply
If the application uses ONLY TEMP DATA, you should define the table as a temporary table to effectively achieve your point while minimizing side steps.

I think that's just what Justin asked/explained up there.
Surachart Opun ...

Posts: 1,469
Registered: 08/09/05
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 4:49 PM   in response to: jetq in response to: jetq
 
Click to report abuse...   Click to reply to this thread Reply
1. Using nologging command in in the definition of table T .
2. Using nologging command in the procedure P.(or /*+ append */ hint. )
3. using direct insert.

Another question: Is the indexes of this table updated correspondingly using these nologging insert methods?

Nologging will generate a minimal number of redo log entries in order to protect the data dictionary.

Nologging is faster than logging
we have to define NOLOGGING in table/index + use insert /*+append */ with inserting.

NOLOGGING is active in the following situations and while running one of the following commands but not after that.

- DIRECT LOAD (SQL*Loader)
- DIRECT LOAD INSERT (using APPEND hint)
- CREATE TABLE ... AS SELECT
- CREATE INDEX
- ALTER TABLE MOVE
- ALTER TABLE ... MOVE PARTITION
- ALTER TABLE ... SPLIT PARTITION
- ALTER TABLE ... ADD PARTITION (if HASH partition)
- ALTER TABLE ... MERGE PARTITION
- ALTER TABLE ... MODIFY PARTITION, ADD SUBPARTITON, COALESCE SUBPARTITON, REBUILD UNUSABLE INDEXES
- ALTER INDEX ... SPLIT PARTITION
- ALTER INDEX ... REBUILD
- ALTER INDEX ... REBUILD PARTITION

these links may help

http://oraclenz.com/__oneclick_uploads/2008/08/redo_reduction_v_1_9.pdf
http://surachartopun.com/2009/06/insertupdatedelete-will-generate-redo.html

Edited by: Surachart Opun on Jul 9, 2009 6:50 AM

jetq

Posts: 923
Registered: 11/24/06
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 6:15 PM   in response to: Justin Cave in response to: Justin Cave
 
Click to report abuse...   Click to reply to this thread Reply
NO, we should keep the table definition and the table structure. This table is only a Transit point.
jetq

Posts: 923
Registered: 11/24/06
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 6:19 PM   in response to: Surachart Opun ... in response to: Surachart Opun ...
 
Click to report abuse...   Click to reply to this thread Reply
Using nologging command in in the definition of table T is useless ?
How about the index on T table when using direct path inserting? Is the index updated while inserting operation?

Edited by: jetq on Jul 8, 2009 9:23 PM
Surachart Opun ...

Posts: 1,469
Registered: 08/09/05
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 6:42 PM   in response to: jetq in response to: jetq
 
Click to report abuse...   Click to reply to this thread Reply
jetq wrote:
Using nologging command in in the definition of table T is useless ?
How about the index on T table when using direct path inserting? Is the index updated while inserting operation?

Edited by: jetq on Jul 8, 2009 9:23 PM

Thank you ... that good question

TABLE=LOGGING
SQL> create table TEST01 as select * from all_objects;

Table created.

INDEX=NOLOGGING

SQL> create index TEST01_IDX01 on TEST01(object_id) nologging;

Index created.

INSERT INTO TEST01 NOLOGGING SELECT * FROM ALL_OBJECTS;

SQL> INSERT INTO TEST01 NOLOGGING SELECT * FROM ALL_OBJECTS;

10914 rows created.

REDO_VALUE
----------
1931708


INSERT /*+ APPEND */ INTO TEST01 SELECT * FROM ALL_OBJECTS;


SQL> INSERT /*+ APPEND */ INTO TEST01 SELECT * FROM ALL_OBJECTS;

10914 rows created.

REDO_VALUE
----------
2099212

INSERT /*+ APPEND */ INTO TEST01 NOLOGGING SELECT * FROM ALL_OBJECTS;

SQL> INSERT /*+ APPEND */ INTO TEST01 NOLOGGING SELECT * FROM ALL_OBJECTS;

10914 rows created.

REDO_VALUE
----------
1616992

After test: "INSERT /*+ APPEND */ INTO TEST01" made least redo size on INDEX(nologging)

By the way, I test with INDEX(logging), "INSERT /*+ APPEND */ INTO TEST01" made least redo size as well.

I think... that'a little difference redo size. But if you "alter table ... nologging" and use SQL with /*+ append*/ that'll not generate redo log(generate only data dictionary).... Be CareFul to use NOLOGGING

If you need to check about TABLE http://surachartopun.com/2009/06/insertupdatedelete-will-generate-redo.html

Edited by: Surachart Opun (HunterX) on Jul 9, 2009 8:42 AM

Edited by: Surachart Opun (HunterX) on Jul 9, 2009 8:47 AM

Edited by: Surachart Opun (HunterX) on Jul 9, 2009 10:01 AM

SomeoneElse

Posts: 9,551
Registered: 10/15/98
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 7:51 PM   in response to: Surachart Opun ... in response to: Surachart Opun ...
 
Click to report abuse...   Click to reply to this thread Reply
INSERT /* APPEND */ INTO TEST01 NOLOGGING SELECT * FROM ALL_OBJECTS;+

Keep in mind that NOLOGGING in this context is nothing more than a table alias for TEST01.

There is no option for LOGGING/NOLOGGING in the syntax of an INSERT statement (or any other DML).

Also, your APPEND hint is just a comment (the plus sign is missing).
Surachart Opun ...

Posts: 1,469
Registered: 08/09/05
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 8:01 PM   in response to: SomeoneElse in response to: SomeoneElse
 
Click to report abuse...   Click to reply to this thread Reply
thank you ...SomeoneElse

about append hint ;) OTN forums change /*+ APPEND / to / APPEND */
when i use + xxx +
mbobak

Posts: 531
Registered: 11/27/07
Re: Which nologging way is better for performance?
Posted: Jul 8, 2009 11:23 PM   in response to: jetq in response to: jetq
 
Click to report abuse...   Click to reply to this thread Reply
jetq wrote:
NO, we should keep the table definition and the table structure. This table is only a Transit point.

Table definition and structure of a global temporary table IS persistent in Oracle. You need to read up on global temporary tables in Oracle. They are not like temporary tables in other databases.

I still think Justin was on the right track, and that a global temporary table is what you want, whether you realize it or not.

See here for more info:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/schema.htm#CNCPT1138

-Mark
Randolf Geist

Posts: 1,634
Registered: 07/03/08
Re: Which nologging way is better for performance?
Posted: Jul 9, 2009 7:31 AM   in response to: mbobak in response to: mbobak
 
Click to report abuse...   Click to reply to this thread Reply
mbobak wrote:
jetq wrote:
NO, we should keep the table definition and the table structure. This table is only a Transit point.

Table definition and structure of a global temporary table IS persistent in Oracle. You need to read up on global temporary tables in Oracle. They are not like temporary tables in other databases.

I still think Justin was on the right track, and that a global temporary table is what you want, whether you realize it or not.


And to make things even more complicated: Even when using global temporary tables (GTT) there is still the need to differentiate between REDO and UNDO generation:

1. A GTT doesn't generate REDO for the data written to the GTT

2. But it DOES generate UNDO for the data written to the GTT, and for the UNDO data REDO will be generated

3. The UNDO generation (and its accompanying REDO generation) for the data can be avoided by using a direct-path insert into the GTT (INSERT /*+ APPEND */)

4. Any indexes on the GTT will always generate REDO for the index maintenance, UNDO and REDO for the UNDO, regardless of the insert mode used.

To the OP: There is no such thing like "NOLOGGING command in the procedure". NOLOGGING is an attribute of an object and as already mentioned only applies to very specific operations. It's about REDO generation, not UNDO.

All conventional DML operations (insert/update/delete) generate REDO and UNDO, regardless of the NOLOGGING attribute of the object. Only direct-path inserts and certain DDL commands make use of the NOLOGGING attribute.

Regards,
Randolf

Oracle related stuff blog:
http://oracle-randolf.blogspot.com/

SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums