473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

General Questions- Need Clearance

Hi,
I need some clearance on the following questions:

1) Does LOAD command updates indexes defined for a table?

2) Is REPLACE option in the LOAD command a logged operation?

Help will be greatly appreciated.

TIA

Nov 12 '05 #1
9 1681
pa***************@yahoo.co.in wrote:
Hi,
I need some clearance on the following questions:

1) Does LOAD command updates indexes defined for a table? Yes
2) Is REPLACE option in the LOAD command a logged operation? Interesting question. I'm quite sur eit is not.
Here is some hint I find in the docs of LOAD:
TERMINATE
One of four modes under which the load utility can execute.
Terminates a previously interrupted load operation, and rolls back the
operation to the point in time at which it started, even if consistency
points were passed. The states of any table spaces involved in the
operation return to normal, and all table objects are made consistent
(index objects might be marked as invalid, in which case index rebuild
will automatically take place at next access). If the load operation
being terminated is a load REPLACE, the table will be truncated to an
empty table after the load TERMINATE operation. If the load operation
being terminated is a load INSERT, the table will retain all of its
original records after the load TERMINATE operation.

The load terminate option will not remove a backup pending state
from table spaces.
Help will be greatly appreciated.

TIA

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
Thanks for the reply serge.
I am still no clear.
"If the load operation
being terminated is a load REPLACE, the table will be truncated to an
empty table after the load TERMINATE operation"
Does this mean it is a non-logged operation as it TRUNCATES the table?
And i am still not clear with the indexes part?
TIA

Nov 12 '05 #3
pa***************@yahoo.co.in wrote:
Thanks for the reply serge.
I am still no clear.
"If the load operation
being terminated is a load REPLACE, the table will be truncated to an
empty table after the load TERMINATE operation"
Does this mean it is a non-logged operation as it TRUNCATES the table? I'm 99% sure of that. Shoudl be easy to test though. And i am still not clear with the indexes part?

LOAD maintains indexes

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #4
Thanks for the reply Serge. I dont know what we do without ur
expertise. :-)

Nov 12 '05 #5
pa***************@yahoo.co.in wrote:
Hi,
I need some clearance on the following questions:

1) Does LOAD command updates indexes defined for a table?
LOAD has to maintain indexes, of course. How else would you ensure the
consistency of indexes and the data in the table?
2) Is REPLACE option in the LOAD command a logged operation?


DB2 needs to write a log record for the truncation, and it truly does so:
http://publib.boulder.ibm.com/infoce...n/r0001910.htm

I just loaded an empty file into a table using the REPLACE option. This
caused the table to be truncated, and it generated the following log
records. The 8th log record is probably the one you're interested in.
Database name : test
Start of LSN Range : 0.187.35944
End of LSN Range : 0.312.32780

================================================== =========================
Log record LSN : 0.187.35944
Next log record LSN : 0.187.36420

Previous log record in transaction : (null)
Transaction identifier : 0.0.287
Length of log record : 476 bytes

Type log record : [0x004A] Table load start
General flags : Propagatable
Written by : Utility Manager

Tablespace identifier : [2] USERSPACE1
Table identifier : [2] DB2I00.X

Table flags : [0x00000000]
Load identifier : LD01

---------------------------------------------------------------------------
Log record LSN : 0.187.36420
Next log record LSN : 0.187.36456

Previous log record in transaction : 0.187.35944
Transaction identifier : 0.0.287
Length of log record : 36 bytes

Type log record : [0x004E] Normal
General flags : Redo always
Written by : Data Management System (DMS)

Function identifier : [124] Alter table attributes
Tablespace identifier : [2] USERSPACE1
Table identifier : [2] DB2I00.X

Table attribute change : [0x00000008] Set table in LOAD state

---------------------------------------------------------------------------
Log record LSN : 0.187.36456
Next log record LSN : 0.187.36664

Previous log record in transaction : 0.187.36420
Transaction identifier : 0.0.287
Length of log record : 208 bytes

Type log record : [0x004E] Normal
General flags : None
Written by : Data Management System (DMS)

Function identifier : [120] Update record
Tablespace identifier : [2] USERSPACE1
Table identifier : [2] DB2I00.X

Page number : 0
Slot number of record/entry on page : 2
Old length of record on page : 76 bytes
Length of record (group) on page : 76 bytes
Free space on page : 2876 bytes
Type of record header : [0x00] (normal)
Storage type of record data : Internal control
Offset of record on page : 2916

---------------------------------------------------------------------------
Log record LSN : 0.187.36664
Next log record LSN : 0.187.36688

Previous log record in transaction : 0.187.36456
Transaction identifier : 0.0.287
Length of log record : 24 bytes

Type log record : [0x006B] Table load locator create
General flags : None
Written by : Utility Manager

Tablespace identifier : [2] USERSPACE1
Table identifier : [2] DB2I00.X
---------------------------------------------------------------------------
Log record LSN : 0.187.36688
Next log record LSN : 0.187.36726

Previous log record in transaction : 0.187.36664
Transaction identifier : 0.0.287
Length of log record : 38 bytes

Type log record : [0x0084] Normal commit
General flags : Propagatable
Written by : Transaction Manager

Authorization : DB2I00
Commit timestamp : Mon Oct 24 13:52:55 2005

---------------------------------------------------------------------------
Log record LSN : 0.187.36726
Next log record LSN : 0.187.37218

Previous log record in transaction : (null)
Transaction identifier : 0.0.288
Length of log record : 476 bytes

Type log record : [0x004A] Table load start
General flags : None
Written by : Utility Manager

Tablespace identifier : [2] USERSPACE1
Table identifier : [2] DB2I00.X

Table flags : [0x00000000]
Load identifier : LD02

---------------------------------------------------------------------------
Log record LSN : 0.187.37218
Next log record LSN : 0.187.37262

Previous log record in transaction : 0.187.36726
Transaction identifier : 0.0.288
Length of log record : 44 bytes

Type log record : [0x0052] Redo
General flags : Redo always
Written by : Data Object Manager (DOM)

Function identifier : [10] Change life Lsn
Tablespace identifier : [2] USERSPACE1
Table identifier : [2] DB2I00.X
Object tablespace : [2] USERSPACE1
Object identifier : [2] DB2I00.X (Table)
Object flags : 0x00000000

Old life LSN : 0.187.33188
Life LSN : 0.187.37218

---------------------------------------------------------------------------
Log record LSN : 0.187.37262
Next log record LSN : 0.187.37402

Previous log record in transaction : 0.187.36726
Transaction identifier : 0.0.288
Length of log record : 140 bytes

Type log record : [0x004E] Normal
General flags : None
Written by : Data Object Manager (DOM)

Truncate timestamp : Mon Oct 24 13:52:56 2005

Function identifier : [11] Truncate table
Tablespace identifier : [2] USERSPACE1
Table identifier : [2] DB2I00.X
Object tablespace : [2] USERSPACE1
Object identifier : [2] DB2I00.X (Table)
Object flags : 0x00000000

Long/LOB data tablespace : [2] USERSPACE1
Long data object identifier : [0]
LOB data object identifier : [0]
Index data tablespace : [2] USERSPACE1
Index data object identifier : [0]
Life LSN : 0.187.36726

---------------------------------------------------------------------------
Log record LSN : 0.187.37402
Next log record LSN : 0.187.37446

Previous log record in transaction : 0.187.37262
Transaction identifier : 0.0.288
Length of log record : 44 bytes

Type log record : [0x0052] Redo
General flags : Redo always
Written by : Data Object Manager (DOM)

Function identifier : [10] Change life Lsn
Tablespace identifier : [2] USERSPACE1
Table identifier : [2] DB2I00.X
Object tablespace : [2] USERSPACE1
Object identifier : [2] DB2I00.X (Table)
Object flags : 0x00000000

Old life LSN : 0.187.37218
Life LSN : 0.187.37402

---------------------------------------------------------------------------
Log record LSN : 0.187.37446
Next log record LSN : 0.250.12

Previous log record in transaction : 0.187.37262
Transaction identifier : 0.0.288
Length of log record : 7336 bytes

Type log record : [0x008A] Local pending list
General flags : None
Written by : Transaction Manager

Commit timestamp : Mon Oct 24 13:52:56 2005

---------------------------------------------------------------------------
Log record LSN : 0.250.12
Next log record LSN : 0.250.94

Previous log record in transaction : (null)
Transaction identifier : 0.0.429
Length of log record : 82 bytes

Type log record : [0x004E] Normal
General flags : None
Written by : Data Management System (DMS)

Function identifier : [118] Insert record
Tablespace identifier : [0] SYSCATSPACE
Table identifier : [13] SYSIBM.SYSDBAUTH

Page number : 0
Slot number of record/entry on page : 6
Length of record (group) on page : 44 bytes
Free space on page : 2650 bytes
Type of record header : [0x00] (normal)
Storage type of record data : Data without VALUE COMPRESSION
Offset of record on page : 2664
Length of fixed data of record : 20 bytes

---------------------------------------------------------------------------
Log record LSN : 0.250.94
Next log record LSN : 0.250.173

Previous log record in transaction : 0.250.12
Transaction identifier : 0.0.429
Length of log record : 79 bytes

Type log record : [0x004E] Normal
General flags : None
Written by : Index Manager

Function identifier : [101] Add key to index
Tablespace identifier : [0] SYSCATSPACE
Table identifier : [13] SYSIBM.SYSDBAUTH
Object tablespace : [0] SYSCATSPACE
Object identifier : [13] (Index)

Root page of index : 2
Page number : 2
Slot number of record/entry on page : 2
Offset of key data in index entry : 0

---------------------------------------------------------------------------
Log record LSN : 0.250.173
Next log record LSN : 0.312.32780

Previous log record in transaction : 0.250.94
Transaction identifier : 0.0.429
Length of log record : 28 bytes

Type log record : [0x0084] Normal commit
General flags : None
Written by : Transaction Manager

Commit timestamp : Mon Oct 24 14:08:04 2005

================================================== =========================
read log records : 13 records
read log bytes : 9011 bytes
worktime : 0.02 seconds

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #6
Thanks for the replies. U guys are gr8. :-)

Nov 12 '05 #7
Knut, I think the practical question is not so only whether I do have a
log entry (which might be needed for rollforward, HADR etc).

Still, this log entry is not enough to say 'rollback': not every row
getting deleted gets a log entry. It is not logged in a sense that I
can rollback the action or recover the data incase of problems without
having a backup.

Pankaj: as for all the phases, when indexes are rebuilt etc, check out:
http://publib.boulder.ibm.com/infoce...n/c0004587.htm

Nov 12 '05 #8
1) LOAD will update/maintain indexes. Look at the INDEXING MODE parameter
in the LOAD command documentation.

2)
a) LOAD is a logged command by itself.
b) The data rows that are loaded are NOT logged.
c) If you have unique indexes defined and are using exception tables to
"trap" duplicates. then:
1) The load command will first delete the duplicate actual rows
inserted in the table in phase one of the load and then 2) will
insert the same rowa in the exception table.

Those deletes and inserts will be logged.

HTH, Pierre.
-
Pierre Saint-Jacques
SES Consultants Inc.
514-737-4515
<pa***************@yahoo.co.in> a écrit dans le message de news:
11*********************@g44g2000cwa.googlegroups.c om...
Hi,
I need some clearance on the following questions:

1) Does LOAD command updates indexes defined for a table?

2) Is REPLACE option in the LOAD command a logged operation?

Help will be greatly appreciated.

TIA


Nov 12 '05 #9
juliane26 wrote:
Still, this log entry is not enough to say 'rollback': not every row
getting deleted gets a log entry. It is not logged in a sense that I
can rollback the action or recover the data incase of problems without
having a backup.


True. But keep in mind the purpose of LOAD: to get data into the database
really _fast_. That implies to avoid the overhead associated with logging
as much as possible. So you cannot undo a LOAD REPLACE operation with a
rollback.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: gcook | last post by:
Hi, I've got an old perl program running on my webserver - so old that I haven't used a perl programmer in about two years :) (we've gone all php for a variety of reasons). Anyway, I'm...
2
by: Ross Micheals | last post by:
All I have some general .NET questions that I'm looking for some help with. Some of these questions (like the first) are ones that I've seen various conflicting information on, or questions that...
9
by: Murali | last post by:
Hi all, I happened to come across these two questions in a site, and I couldn't think or get hold of an answer to these two questions. 1) Multiple inheritance - objects contain how many...
6
by: Andy | last post by:
Someone posted this official proposal to create comp.databases.postgresql.general again. He wrote his own charter. As far as I know, he did not consult any of the postgresql groups first. There...
1
by: asdsd sir | last post by:
Hi!I'm new in Python and i'd like to ask some general questions about stdin,stdout... Firstly... if we type like something like : cat "file.txt"|python somefile.py #somefile.py import sys
6
by: djc | last post by:
I had previously (in asp.net 1.1 and asp.net web matrix) just done this to populate a listbox with data from a database: ------------ this was from the page load event ---------------- 'fill...
4
by: Viviana Vc | last post by:
Hi all, I've read the WindowsVistaUACDevReqs.doc documentation and I have done different small tests on Vista to understand the bahaviour and now I have a few questions. 1) If I create a...
2
by: SpotNet | last post by:
Scott M. Have your experiences shown you that programmers may give the best computer advice, analysis, and solutions even at the worst of times, for a PC user? ;~D Haven't crossed many Network...
3
by: =?Utf-8?B?Ymxi?= | last post by:
I am posting to the general discussion group - but I cannot find my postings... or replies...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.