Solved

deleting rows takes more time

Posted on 2010-11-23
6
496 Views
Last Modified: 2013-12-07
Hi,

I have 3 tables A,B,C.......each of them has more then 100000 rows, n I would like to delete all the rows from three tables but it is taking too much of time.

Table A has triggers like, if anything deletes from A, it will add it to B and
second trigger like whatever is deleted from A, those records will be deleted from B also.

How can I solve this problem?
0
Comment
Question by:sridhar_ravva
6 Comments
 
LVL 73

Expert Comment

by:sdstuber
ID: 34200189
could you disable the triggers?

or,  truncate each table, that doesn't fire triggers
0
 
LVL 14

Expert Comment

by:ajexpert
ID: 34200608
if you want to delete ALL records, best way is to use TRUNCATE.

Downside of using TRUNCATE is that you might have to disable constraints this table is being referred
0
 

Author Comment

by:sridhar_ravva
ID: 34201213
sorry, I missed something:
"second trigger like whatever is deleted from A, those records will be deleted from B also."

is wrong
actually table C has many other data also. I just need to delete all the data from table A and B but delete only those records from C which are deleted from A.
Table C has other data too, other than just table A.
0
 
LVL 73

Accepted Solution

by:
sdstuber earned 500 total points
ID: 34201430
truncate A,  truncate B,

delete C where not exists (select null from A where a.col1 = c.col1 and a.col2 = b.col2)


expand to the appropriate columns and add NULL checks if necessary
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 34421478
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now