473,326 Members | 2,175 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,326 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 7237
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.