dbTalk Databases Forums  

IMPORT vs. LOAD

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss IMPORT vs. LOAD in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gregor Kovač
 
Posts: n/a

Default IMPORT vs. LOAD - 05-19-2010 , 11:31 PM






Hi!

Today we had a hot discussion about the performance of LOAD vs. IMPORT.
I'd like to hear what you have to say:
- Should LOAD be faster that IMPORT in every circumstance?
- Is IMPORT more suited for small files and LOAD for large files?
- Is LOAD more suited for table that have many indexes and IMPORT for tables
that have few or no indexes?

Best regards,
Kovi

Reply With Quote
  #2  
Old   
Frederik Engelen
 
Posts: n/a

Default Re: IMPORT vs. LOAD - 05-20-2010 , 03:27 AM






On May 20, 6:31*am, Gregor Kovač <gregor.ko... (AT) mikropis (DOT) si> wrote:
Quote:
Hi!

Today we had a hot discussion about the performance of LOAD vs. IMPORT.
I'd like to hear what you have to say:
- Should LOAD be faster that IMPORT in every circumstance?
- Is IMPORT more suited for small files and LOAD for large files?
- Is LOAD more suited for table that have many indexes and IMPORT for tables
that have few or no indexes?

Best regards,
* * * * Kovi
Hello Kovi,

Interesting questions, although I'm not sure they are always the rigth
ones to ask. There are factors that can influence your choice for
IMPORT or LOAD that might be more important:
- recoverability of the operation
- for moving data between databases, load from cursor has a lot of
advantages
- availability of data during/after insert
- presence of generated columns
- compression on tables
- ...

I'll still try to give a shot at your questions, though:
Quote:
- Should LOAD be faster that IMPORT in every circumstance?
I tried a small table with a lot of indexes. A load operation takes
consistently 4 times longer than the corresponding insert. Another
thing to consider for no-so large tables: how fast can you type 'SET
INTEGRITY...'? :-)

Quote:
- Is IMPORT more suited for small files and LOAD for large files?
I think you need to consider at least the points above before taking
into account the size of the file.

Quote:
- Is LOAD more suited for table that have many indexes and IMPORT for tables
According to my little test on a small table with lots of indexes (15
on a 3-column table), it's exactly the inverse. I didn't do the test
for large tables, there it might also depend on the indexing mode you
choose (incremental or rebuild). I suggest you just give it a try
yourself.

--
Frederik Engelen
Realdolmen

Reply With Quote
  #3  
Old   
Serge Rielau
 
Posts: n/a

Default Re: IMPORT vs. LOAD - 05-20-2010 , 09:29 AM



Kovi,

Feedback from backstage:

Load is faster than import in most of cases. Better to describe cases
where import can be faster:

1) Correct about small files. Load has a startup and shutdown cost.
2) Parallel import can catch up and beat load (ie, running lots of
parallel import command with the data split already) specifically when
XML is in the table.

More indexes will likely hurt import more than load, because the data
isn't sorted, and the index inserts are a single row at a time. Load
will be faster with larger files regardless of the number of indexes

--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab

Reply With Quote
  #4  
Old   
kenfar
 
Posts: n/a

Default Re: IMPORT vs. LOAD - 05-21-2010 , 08:09 AM



On May 20, 8:29*am, Serge Rielau <srie... (AT) ca (DOT) ibm.com> wrote:

Quote:
More indexes will likely hurt import more than load, because the data
isn't sorted, and the index inserts are a single row at a time. *Load
will be faster with larger files regardless of the number of indexes
I've found that indexes are my enemy with the load utility - even
though I can load the data in parallel and only do incremental index
builds, the index build phase isn't parallel. Rebuilding indexes
isn't a great strategy for real-time data warehousing, and I don't yet
have enough funding to go to DPF. My current server has a decent
number of rather slow CPUs. So, in this scenario I can split a file
into 8 individual pieces then import each simultaneously and get
better overall performance. Unfortunately. Think I might be missing
anything?


Thanks,

Ken

Reply With Quote
  #5  
Old   
Serge Rielau
 
Posts: n/a

Default Re: IMPORT vs. LOAD - 05-21-2010 , 10:36 PM



On 5/21/2010 9:09 AM, kenfar wrote:
Quote:
On May 20, 8:29 am, Serge Rielau<srie... (AT) ca (DOT) ibm.com> wrote:

More indexes will likely hurt import more than load, because the data
isn't sorted, and the index inserts are a single row at a time. Load
will be faster with larger files regardless of the number of indexes

I've found that indexes are my enemy with the load utility - even
though I can load the data in parallel and only do incremental index
builds, the index build phase isn't parallel. Rebuilding indexes
isn't a great strategy for real-time data warehousing, and I don't yet
have enough funding to go to DPF. My current server has a decent
number of rather slow CPUs. So, in this scenario I can split a file
into 8 individual pieces then import each simultaneously and get
better overall performance. Unfortunately. Think I might be missing
anything?
Just a hunch. You are on DB2 9.1 or Db2 8? I.e. prior to the
multi-threaded engine?

Cheers
Serge

--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab

Reply With Quote
  #6  
Old   
Gregor Kovač
 
Posts: n/a

Default Re: IMPORT vs. LOAD - 06-01-2010 , 07:48 AM



Hi!

Thanks for the feedback.
I am/was under the impression that IMPORT does a exclusive table lock. How
can I do parallel import then?

Best regards,
Kovi

Serge Rielau wrote:

Quote:
Kovi,

Feedback from backstage:

Load is faster than import in most of cases. Better to describe cases
where import can be faster:

1) Correct about small files. Load has a startup and shutdown cost.
2) Parallel import can catch up and beat load (ie, running lots of
parallel import command with the data split already) specifically when
XML is in the table.

More indexes will likely hurt import more than load, because the data
isn't sorted, and the index inserts are a single row at a time. Load
will be faster with larger files regardless of the number of indexes

--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Quote:
Gregor Kovac | Gregor.Kovac (AT) mikropis (DOT) si |
| http://kovica.blogspot.com |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In A World Without Fences Who Needs Gates? |
Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

Reply With Quote
  #7  
Old   
Frederik Engelen
 
Posts: n/a

Default Re: IMPORT vs. LOAD - 06-01-2010 , 08:41 AM



On Jun 1, 2:48*pm, Gregor Kovač <gregor.ko... (AT) mikropis (DOT) si> wrote:
Quote:
Hi!

Thanks for the feedback.
I am/was under the impression that IMPORT does a exclusive table lock. How
can I do parallel import then?

Best regards,
* * * * Kovi





Serge Rielau wrote:
Kovi,

Feedback from backstage:

Load is faster than import in most of cases. * Better to describe cases
where import can be faster:

1) Correct about *small files. *Load has a startup and shutdown cost.
2) Parallel import can catch up and beat load (ie, running lots of
parallel import command with the data split already) specifically when
XML is in the table.

More indexes will likely hurt import more than load, because the data
isn't sorted, and the index inserts are a single row at a time. *Load
will be faster with larger files regardless of the number of indexes

--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| Gregor Kovac | * *Gregor.Ko... (AT) mikropis (DOT) si * * *|
| * * * * * * *| * *http://kovica.blogspot.com*|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| *In A World Without Fences Who Needs Gates? * |
| * * * * * * *Experience Linux. * * * * * * * *|
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
From the 'Data Movement Utilities Guide and Reference' e-book:

"Import acquires either an exclusive (X) lock or a nonexclusive (IX)
lock on existing target tables, depending on whether you allow
concurrent access to the table."

Did you already download this book? As you seem interested in the
matter, I really think you should take a look at it.

--
Frederik Engelen
RealDolmen

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.