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

Dropping tables

I have to drop large numbers of test tables (> 200) fairly often. This
operation seems to be very slow.

Is there some way to speed up the process of dropping tables?
Dec 21 '05 #1
7 4639
Have you tried placing them in their own tablespace and dropping the
tablespace?

Phil Sherman
Ross Mallett wrote:
I have to drop large numbers of test tables (> 200) fairly often. This
operation seems to be very slow.

Is there some way to speed up the process of dropping tables?

Dec 21 '05 #2
Phil Sherman wrote:
Have you tried placing them in their own tablespace and dropping the
tablespace?

Phil Sherman
Ross Mallett wrote:
I have to drop large numbers of test tables (> 200) fairly often. This
operation seems to be very slow.

Is there some way to speed up the process of dropping tables?


Yes.

It doesn't seem to be any faster. However, maybe I should try putting
each table in its own tablespace.
Jan 11 '06 #3
DB2 (at least for LUW) doesn't allow to drop a table space if there is
one object (tables or index) allocated on it. So that souldn't going to
work.

-Eugene

Jan 11 '06 #4
DB2 (at least for LUW) doesn't allow to drop a table space if there is
one object (tables or index) allocated on it. So that souldn't going to
work.

-Eugene

Jan 11 '06 #5
Eugene F wrote:
DB2 (at least for LUW) doesn't allow to drop a table space if there is
one object (tables or index) allocated on it. So that souldn't going to
work.


This statement is wrong. You can drop the tablespace and it will drop all
tables in it:

$ db2 "create tablespace ts managed by database using ( file 'ts' 1000 )"
DB20000I The SQL command completed successfully.
$ db2 "create table x ( a int ) in ts"
DB20000I The SQL command completed successfully.
$ db2 "select count(*) from syscat.tables where tabname = 'X'"

1
-----------
1

1 record(s) selected.

$ db2 "drop tablespace ts"
DB20000I The SQL command completed successfully.
$ db2 "select count(*) from syscat.tables where tabname = 'X'"

1
-----------
0

1 record(s) selected.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Jan 11 '06 #6
Ok I'm wrong not being 100% exact because my opinion was based on a
"real-life" case scenario I had hit in the past: attemp to drop a
tablespace with a table(s) having an index in another tablespace which
(I just checked) caused the failure like this:

db2 => create table t(i int) in data_1 index in index_1
db2 => drop tablespace data_1
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0282N Table space "DATA_1" cannot be dropped because at least one
of the
tables in it, "DB2INST1.T", has one or more of its parts in another
table
space. SQLSTATE=55024

BTW, I can recall, dropping a large number of tables can be slow if the
DROPPED TABLE RECOVERY is ON for the tablespace where these tables
live.

-Eugene

Jan 11 '06 #7
That worked as expected because the table components are split in two
tblspcs.
In that case you cannot drop the data or index tablespace singly.
What you can do though is:
db2 drop tablespace data_1, index_1

And that will drop everything.
HTH, Pierre.

--
Pierre Saint-Jacques
SES Consultants Inc.
514-737-4515
"Eugene F" <ro********@yahoo.com> a écrit dans le message de news:
11*********************@o13g2000cwo.googlegroups.c om...
Ok I'm wrong not being 100% exact because my opinion was based on a
"real-life" case scenario I had hit in the past: attemp to drop a
tablespace with a table(s) having an index in another tablespace which
(I just checked) caused the failure like this:

db2 => create table t(i int) in data_1 index in index_1
db2 => drop tablespace data_1
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0282N Table space "DATA_1" cannot be dropped because at least one
of the
tables in it, "DB2INST1.T", has one or more of its parts in another
table
space. SQLSTATE=55024

BTW, I can recall, dropping a large number of tables can be slow if the
DROPPED TABLE RECOVERY is ON for the tablespace where these tables
live.

-Eugene


Jan 11 '06 #8

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

Similar topics

0
by: Jonathan Villa | last post by:
I have a shopping cart which creates temporary tables in the format of zorder_<phpsessionid>; These tables are used to hold a customers order while they shop and after checking out, it is...
0
by: Rob Baxter | last post by:
I have a linux server which is hosting several very large (~20GB) databases. In order to save some disk space I dropped an index on one of the larger (InnoDB) tables because it is no longer needed....
0
by: K Finegan | last post by:
I have an archival process on a large database that runs once a month. At the beginning of the process the triggers and indexes on the tables whose data is moved are dropped, the data is moved and...
4
by: Dmitri | last post by:
I just looked at a coworker's stored procedure and this person is dropping 4 Foreign key constraints and then re-adding them after processing the required logic (updating rows in the 4 tables in...
0
by: Kumar | last post by:
Need urgent help.... I wanted update one table which has a primary key and also has few dependents. I dropped Primary key before update sothat it won't affect the dependent tables. After...
2
by: deko | last post by:
ALTER TABLE DROP CONSTRAINT ; Is this syntax correct? The error I'm getting is: Error Number 3199: Could not find reference. I tried it without the curly braces, but no luck.
8
by: sat | last post by:
hi all! I have a doubt regarding the dropping of a column. As i've seen, we have an option like "alter table <table namedrop column <column name>" in oracle. Do we have any method in db2 to drop...
0
by: phil | last post by:
Problem Dropping Members from a Replication Set Originally posted: 2007 May 21 04:36 AM 9200Phil Post new reply Hi I'm trying to drop a number of tables from a replication set. Environment:
1
by: DWiggin | last post by:
We are getting deadlock errors (sporadically) on a batch job we've created. This job runs against a SQL Server 2000 back-end. The first step of the batch job is to run a DDL script to drop...
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.