473,385 Members | 1,342 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,385 software developers and data experts.

How to delete tables completely?

Hi everyone.
I need to completely remove all entries in a number of tables.
Dropping the tables works fine - my only problem is, that in production
environment I don't have the right to drop the tables .. ;)

So I try to delete all entries - but experience that subsequent access to
the database (a lot of different selects and inserts invoked via java) is
much slower than it would be on dropped and new created tables. (Just as
if they weren't empty.)

My SQL looks like that:

delete from mytable;
commit;
reorg table mytable;
commit;
runstats on table myTable on all columns;
commit;
Thereafter the tables _are_ empty, but my DB2 data directory still takes
a lot more disk space than it would with newly created tables ...

Am I missing something?
Is there something concerning the indexes I should do after deletion?

I'm working on DB2 8 (8.1.0.36), but DB2 7.2 seems to behave the same way.

Thanks in advance for any hints, Robert Kersten.
Nov 12 '05 #1
2 7244
Jag
try import replace from empty file

"Robert Kersten" <ke******@cs.tu-berlin.de> wrote in message
news:ci**********@news.cs.tu-berlin.de...
Hi everyone.
I need to completely remove all entries in a number of tables.
Dropping the tables works fine - my only problem is, that in production
environment I don't have the right to drop the tables .. ;)

So I try to delete all entries - but experience that subsequent access to
the database (a lot of different selects and inserts invoked via java) is
much slower than it would be on dropped and new created tables. (Just as
if they weren't empty.)

My SQL looks like that:

delete from mytable;
commit;
reorg table mytable;
commit;
runstats on table myTable on all columns;
commit;
Thereafter the tables _are_ empty, but my DB2 data directory still takes
a lot more disk space than it would with newly created tables ...

Am I missing something?
Is there something concerning the indexes I should do after deletion?

I'm working on DB2 8 (8.1.0.36), but DB2 7.2 seems to behave the same way.

Thanks in advance for any hints, Robert Kersten.

Nov 12 '05 #2
Robert,

why not simply

LOAD FROM /dev/null of del replace into tablename NONRECOVERABLE
- This truncates the table very quickly, not sure if
it reclaims space updates stats by default?

This has the added advantage that you don't have to
perform deletes in the correct RI order.
(though you will have to do a SET INTEGRITY afterwards)

OK
Nov 12 '05 #3

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

Similar topics

2
by: michael | last post by:
Gotta post because this is driving me nuts. Trying to DELETE orphans. I can successfully: SELECT GroupID FROM Groups LEFT JOIN Users ON UsersID = UserID WHERE UsersID IS NULL; but when I...
5
by: Mike | last post by:
I am not a sql person and could use some help with a delete...here is what I want: I have the following tables/fields (only including necessary fields) answers result_id results result_id
4
by: MC | last post by:
i have table Controller (ControllerID, ControllerNAme, isActive) and tables SendControllerForCitizenClaim (SendID, ControllerID, Region), table SendControllerForCompanyClaim (SendID, ControllerID,...
1
by: war_wheelan | last post by:
I have a database file approximately 30GB in size which creates 3 data tables daily. I need to reduce the size of the DB due to disk size limitations. Could I EXPORT some tables, let us say over...
2
by: Jacky Luk | last post by:
Hi, I can't seem to find a way to delete all records of a table. I created my tables in MySQL Query Browser, then fill them up with VC++, but some records were incorrect, And I had to recreate the...
2
by: NoSpam | last post by:
Hi, I am working with C# and ASP.NET with code behind and a SQL Server. I'm making an e-shop. When clients see what they have in their basket, I added a function DELETE to delete a line. It took...
6
by: ilo | last post by:
When I want to delete a data from a table that this tabl has a trigger and this trigger reached another tables to delete the data in cursor I have this messeage: DELETE failed because the...
1
by: jpr | last post by:
Hello, My database has 5 tables. WHen I add data to one table, it runs an append query that copies three records to other 4 tables. The main table is MASTER. The data I copy are: ID, SSN and...
29
by: Jon Slaughter | last post by:
Is it safe to remove elements from an array that foreach is working on? (normally this is not the case but not sure in php) If so is there an efficient way to handle it? (I could add the indexes to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.