Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / November 2004

Tip: Looking for answers? Try searching our database.

estimate log size of "insert into...select * from..."

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fan Ruo Xin - 23 Nov 2004 01:48 GMT
How to estimate the size of log space when I need to run "INSERT INTO
tgt_tbl SELECT * FROM src_tbl WHERE..." ?
What is the difference of before image between the above INSERT stmt and the
following:
begin transaction
INSERT INTO tgt_tbl VALUES (...);
...
INSERT INTO tgt_tbl VALUES (...);
end transaction;
Matt Emmerton - 25 Nov 2004 16:51 GMT
> How to estimate the size of log space when I need to run "INSERT INTO
> tgt_tbl SELECT * FROM src_tbl WHERE..." ?
[quoted text clipped - 5 lines]
>  INSERT INTO tgt_tbl VALUES (...);
>  end transaction;

A rough estimate of how much log space will be needed is:
 log space needed (in 4K pages) = number_of_rows * row_length (in bytes) *
1.05 (for log record overhead) / 4096

--
Matt
Fan Ruo Xin - 26 Nov 2004 23:18 GMT
> > How to estimate the size of log space when I need to run "INSERT INTO
> > tgt_tbl SELECT * FROM src_tbl WHERE..." ?
[quoted text clipped - 13 lines]
> --
> Matt

Thanks, Matt. I thought the formula is for my second case. AFAIK, the first
one will use smaller log space than the second one. But I can't find any
reference from the db2 documentation. Do you know what the difference is
between the before&after image when db2 log both transactions?
Matt Emmerton - 28 Nov 2004 18:05 GMT
> > > How to estimate the size of log space when I need to run "INSERT INTO
> > > tgt_tbl SELECT * FROM src_tbl WHERE..." ?
[quoted text clipped - 19 lines]
> reference from the db2 documentation. Do you know what the difference is
> between the before&after image when db2 log both transactions?

If both transactions do the same amount of work (ie, same number of inserts,
same data), then the amount of log space used will be the same.

--
Matt Emmerton
Fan Ruo Xin - 30 Nov 2004 03:42 GMT
> > > > How to estimate the size of log space when I need to run "INSERT INTO
> > > > tgt_tbl SELECT * FROM src_tbl WHERE..." ?
[quoted text clipped - 28 lines]
> --
> Matt Emmerton

Hi, Matt,
I did a test (maybe) two months ago - I build a table A and load a couple of
records, and copy the ddl and data to tableB.
The "delete from tableA" and empty tableA and then "import ... into tableA"
without COMMITCOUNT failed as "log full". But not "insert into tableA select
* from tableB".
I will double check if I can reproduce the scenario.
Thanks,
FRX
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.