473,805 Members | 2,172 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4674
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********@yah oo.com> a écrit dans le message de news:
11************* ********@o13g20 00...legro ups.com...
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
1796
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 dropped. The values of the shopping cart are put together in an HTML table and stored as their history. What I want to do is to run a cron job to delete the orders which were left undone once a day at about midnight. Here is my current query
0
1994
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. It took about 30 minutes for MySQL to drop the index, during which time I saw the free disk space decrease. I didn't think anything of it while the drop operation was running because I figured it was some kind of temp file being used by the drop...
0
1515
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 then the triggers and indexes are recreated at the end. This produces a massive improvement in performance. The problem is the process is supposed to run on users accounts (thats the way the front-end is set up) and they don't have the...
4
2033
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 question). Is there *ANY* good reason to do this? What are the performance implications of doing this - negative or otherwise? I was furious when I found this because every once in a while I would notice that the constraints would be in...
0
415
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 dropping promary key, I could see many packages were invalid in syscat.packages (VALID column).
2
2044
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
7040
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 a column? Or is there any process for dropping a column in db2? if so, please let me know.
0
1407
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
2024
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 and create 4 tables that are used in the job. The tables are only used during this job and are not accessed by any other process or application. The second step of the batch job is to make an OSQL call to run the stored procedures associated with...
0
9718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10368
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10107
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.