Hi All,
I am getting strange situation. These r the steps I have followed:
1. Created an EMPLOYEE table with around 14 fields & 688038 records.
(so a large table indeed).
2. Tried to delete all the rows in the table using the traditional
DELETE FROM EMPLOYEE stmt. It is taking around 53 secs to delete all
the records.
So I have done the below steps to make it fatster:
(i) Create an empty file called No_Data.DEL in the C:\ drive.
(Location & name of file doesn't matter , BUT it shud be an empty
file.)
(ii) Executed the following stmt: IMPORT FROM C:\No_Data.DEL OF DEL
REPLACE INTO Employee.
This stmt took less that 1 sec to delete all the data in the Employee
table.
THIS IS THE FASTER APROACH TO DELETE RECORDS FROM A TABLE.
But I wnat to know ,how did it happen so? Why did the IMPORT stmt take
that much less time to delete all the records , which the traditional
DELETE took a large amount of time.
Thanx in advance....
Awaiting ur replies,
Satish.. 6 11060
On Mar 20, 8:30 am, "satish mullapudi" <satishmullapud...@gmail.com>
wrote:
Hi All,
I am getting strange situation. These r the steps I have followed:
1. Created an EMPLOYEE table with around 14 fields & 688038 records.
(so a large table indeed).
2. Tried to delete all the rows in the table using the traditional
DELETE FROM EMPLOYEE stmt. It is taking around 53 secs to delete all
the records.
So I have done the below steps to make it fatster:
(i) Create an empty file called No_Data.DEL in the C:\ drive.
(Location & name of file doesn't matter , BUT it shud be an empty
file.)
(ii) Executed the following stmt: IMPORT FROM C:\No_Data.DEL OF DEL
REPLACE INTO Employee.
This stmt took less that 1 sec to delete all the data in the Employee
table.
THIS IS THE FASTER APROACH TO DELETE RECORDS FROM A TABLE.
But I wnat to know ,how did it happen so? Why did the IMPORT stmt take
that much less time to delete all the records , which the traditional
DELETE took a large amount of time.
Thanx in advance....
Awaiting ur replies,
Satish..
You could do this:
ALTER TABLE EMPLOYEE NOT LOGGED INITIALLY WITH EMPTY TABLE;
This really works. Here in this cmd u r specifying to replace with an
EMPTY TABLE and that too WITHOUT LOGGING. So, the operation is
performed Faster. But in the one am asking using the IMPORT utility,
can u plz say why it is done faster than the normal DELETE operation.
--
Satish.
Otto Carl Marte wrote:
On Mar 20, 8:30 am, "satish mullapudi" <satishmullapud...@gmail.com>
wrote:
Hi All,
I am getting strange situation. These r the steps I have followed:
1. Created an EMPLOYEE table with around 14 fields & 688038 records.
(so a large table indeed).
2. Tried to delete all the rows in the table using the traditional
DELETE FROM EMPLOYEE stmt. It is taking around 53 secs to delete all
the records.
So I have done the below steps to make it fatster:
(i) Create an empty file called No_Data.DEL in the C:\ drive.
(Location & name of file doesn't matter , BUT it shud be an empty
file.)
(ii) Executed the following stmt: IMPORT FROM C:\No_Data.DEL OF DEL
REPLACE INTO Employee.
This stmt took less that 1 sec to delete all the data in the Employee
table.
THIS IS THE FASTER APROACH TO DELETE RECORDS FROM A TABLE.
But I wnat to know ,how did it happen so? Why did the IMPORT stmt take
that much less time to delete all the records , which the traditional
DELETE took a large amount of time.
Thanx in advance....
Awaiting ur replies,
Satish..
You could do this:
ALTER TABLE EMPLOYEE NOT LOGGED INITIALLY WITH EMPTY TABLE;
satish mullapudi wrote:
Hi All,
I am getting strange situation. These r the steps I have followed:
1. Created an EMPLOYEE table with around 14 fields & 688038 records.
(so a large table indeed).
Not really that large...
2. Tried to delete all the rows in the table using the traditional
DELETE FROM EMPLOYEE stmt. It is taking around 53 secs to delete all
the records.
So I have done the below steps to make it fatster:
(i) Create an empty file called No_Data.DEL in the C:\ drive.
(Location & name of file doesn't matter , BUT it shud be an empty
file.)
(ii) Executed the following stmt: IMPORT FROM C:\No_Data.DEL OF DEL
REPLACE INTO Employee.
It's ever simpler to do:
IMPORT FROM NUL OF DEL REPLACE INTO ...
Then you don't have to create the empty file.
This stmt took less that 1 sec to delete all the data in the Employee
table.
THIS IS THE FASTER APROACH TO DELETE RECORDS FROM A TABLE.
But I wnat to know ,how did it happen so? Why did the IMPORT stmt take
that much less time to delete all the records , which the traditional
DELETE took a large amount of time.
When a row is deleted in a table, DB2 has to log the data change. This is
necessary because you may issue a ROLLBACK at EOT, and then DB2 must be
able to restore the table to the state it was before the DELETE (actually
to the state it was at BOT). So all the data of the deleted rows is needed
somehow. With a lot of rows, you get a lot of log records being written.
The IMPORT/REPLACE does not log each row. It writes a single table
truncation log record, which is much faster.
The alternative to use NOT LOGGED INITIALLY WITH EMPTY TABLE also avoids the
logging and, thus, is much faster than a DELETE statement.
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Thanx Knut for ur explaination.
satish...
Knut Stolze wrote:
satish mullapudi wrote:
Hi All,
I am getting strange situation. These r the steps I have followed:
1. Created an EMPLOYEE table with around 14 fields & 688038 records.
(so a large table indeed).
Not really that large...
2. Tried to delete all the rows in the table using the traditional
DELETE FROM EMPLOYEE stmt. It is taking around 53 secs to delete all
the records.
So I have done the below steps to make it fatster:
(i) Create an empty file called No_Data.DEL in the C:\ drive.
(Location & name of file doesn't matter , BUT it shud be an empty
file.)
(ii) Executed the following stmt: IMPORT FROM C:\No_Data.DEL OF DEL
REPLACE INTO Employee.
It's ever simpler to do:
IMPORT FROM NUL OF DEL REPLACE INTO ...
Then you don't have to create the empty file.
This stmt took less that 1 sec to delete all the data in the Employee
table.
THIS IS THE FASTER APROACH TO DELETE RECORDS FROM A TABLE.
But I wnat to know ,how did it happen so? Why did the IMPORT stmt take
that much less time to delete all the records , which the traditional
DELETE took a large amount of time.
When a row is deleted in a table, DB2 has to log the data change. This is
necessary because you may issue a ROLLBACK at EOT, and then DB2 must be
able to restore the table to the state it was before the DELETE (actually
to the state it was at BOT). So all the data of the deleted rows is needed
somehow. With a lot of rows, you get a lot of log records being written.
The IMPORT/REPLACE does not log each row. It writes a single table
truncation log record, which is much faster.
The alternative to use NOT LOGGED INITIALLY WITH EMPTY TABLE also avoids the
logging and, thus, is much faster than a DELETE statement.
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Knut Stolze wrote:
>
The alternative to use NOT LOGGED INITIALLY WITH EMPTY TABLE also avoids the
logging and, thus, is much faster than a DELETE statement.
Beware, though, because doing this will affect your ability to recover a
database to a point in time. That is why some people prefer using IMPORT.
On Mar 21, 4:06 am, Ian <ianb...@mobileaudio.comwrote:
Knut Stolze wrote:
The alternative to use NOT LOGGED INITIALLY WITH EMPTY TABLE also avoids the
logging and, thus, is much faster than a DELETE statement.
Beware, though, because doing this will affect your ability to recover a
database to a point in time. That is why some people prefer using IMPORT.
when it cames to delete parts of 300 millions records , i can't tell
which approach is better .
1. alter table ... activate not logged initially ; delete ...
(affect recovery)
2. export&truncate&import (need more file spaces and seems ugly)
3. traditional delete ( slow and have to worry about db log space )
4. build a procedure using a cursor to control the commitcount
( slove db log space problem , but slowest) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alvin |
last post by:
Hi All
I need opinions on how to approach my task.
I currently have 3 tables: the master table, the archive and a temp
table.
MASTER: has 3 fields ProductID and ProductNo and Released
ARCHIVE:...
|
by: DaveDiego |
last post by:
I've had a user delete one of the client records, I do have a version of
the DB with all records intact before the deletion occured.
Whats the best approach to getting all the related records in...
|
by: Paul T. Rong |
last post by:
Dear all,
Here is my problem:
There is a table "products" in my access database, since some of the
products are out of date and stopped manufacture, I would like to delete
those PRODUCTS from...
|
by: Danny Dy |
last post by:
Hi To All,
I always write My VBA code in SQL(see Example).
Private Sub cbxAEName_NotInList(NewData As String, Response As Integer)
Dim stSQL as String
Dim strMsg As String
strMsg = "'" &...
|
by: Yisroel Markov |
last post by:
Greetings,
I have this database I converted from Access 97 to Access 2000. Front
end on the PC, back end on the server. It works fine, except for one
thing: one of the reports is extremely slow...
|
by: Dave |
last post by:
(My apologies for posting this on two forums. I have just found out the other
one was the incorrect location)
I am writing a VB.NET 2003 web application to operate on my company's
intranet. It...
|
by: Cornelius Buschka |
last post by:
Hi,
we saw the following problem:
We deleted all rows from a table B referencing table A (~500000 records). No
problem, but the following try to delete all records from table A (~180000) lead...
|
by: scott.tang |
last post by:
I'm experiencing a very strange problem. My application is MS Access
front-end and MS SQL server back-end database. I have a SQL statement
that deletes records from a table after an export...
|
by: Andy |
last post by:
To further follow up on my last post regarding the docmd.quit vs.
Application.quit using access 2007, I noticed that docmd.quit will correctly
compact the database (program file) if you have the...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
|
by: DizelArs |
last post by:
Hi all)
Faced with a problem, element.click() event doesn't work in Safari browser.
Tried various tricks like emulating touch event through a function:
let clickEvent = new Event('click', {...
|
by: F22F35 |
last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...
| |