473,785 Members | 2,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deleting large amounts of data

4 New Member
Hi,

I'm currently running a delete process based on the results of a sub query but its taking forever to run. I'm new to using Oracle, and am constantly looking for better ways of doing things and wondered if anyone could help......

delete FROM DELTA_OD001
WHERE order_no in
(SELECT Td.order_no
FROM IMPORT_OD001_CU STOMERS CD, DELTA_OD001 TD
WHERE CD.ORANGE_ID = TD.ORANGE_ID);

The volume of rows in Delta_od001 is approx 8.5million and will go up 250k per week. The number of records matched in the sub select if about 950k, and will be relatively constant each week, although will probably drop to about 700k on average.

Do you know of a better way to do this?
Oct 30 '08 #1
5 4548
Pilgrim333
127 New Member
Can you use PL/SQL as well?
Oct 30 '08 #2
themightyrhino
4 New Member
Not got massive amounts of experience with it, however im doing this through SQL Developer so dont see why not...
Oct 30 '08 #3
Pilgrim333
127 New Member
Then try making a procedure of it.

Make a cursor and loop through that cursor and delete every record you find in that cursor. I think what is making the delete statement so slow, is the in clause you are using.


It should look something like this:
Expand|Select|Wrap|Line Numbers
  1. declare
  2.  
  3. cursor c_ord
  4. is
  5.   SELECT Td.order_no
  6.   FROM IMPORT_OD001_CUSTOMERS CD
  7.      , DELTA_OD001 TD
  8.   WHERE CD.ORANGE_ID = TD.ORANGE_ID
  9. ;
  10. begin
  11.   for r_ord in c_ord loop
  12.     delete FROM DELTA_OD001
  13.     WHERE order_no = r_ord.order_no;
  14.   end loop;
  15.   commit;
  16. end;
  17.  
If you get a snapshot too old, let me know, then i will tell you how to get around that.

Pilgrim.
Oct 30 '08 #4
themightyrhino
4 New Member
Then try making a procedure of it.

Make a cursor and loop through that cursor and delete every record you find in that cursor. I think what is making the delete statement so slow, is the in clause you are using.


It should look something like this:
Expand|Select|Wrap|Line Numbers
  1. declare
  2.  
  3. cursor c_ord
  4. is
  5.   SELECT Td.order_no
  6.   FROM IMPORT_OD001_CUSTOMERS CD
  7.      , DELTA_OD001 TD
  8.   WHERE CD.ORANGE_ID = TD.ORANGE_ID
  9. ;
  10. begin
  11.   for r_ord in c_ord loop
  12.     delete FROM DELTA_OD001
  13.     WHERE order_no = r_ord.order_no;
  14.   end loop;
  15.   commit;
  16. end;
  17.  
If you get a snapshot too old, let me know, then i will tell you how to get around that.

Pilgrim.

Thanks, will give it a try!
Oct 30 '08 #5
amitpatel66
2,367 Recognized Expert Top Contributor
Hi,

I'm currently running a delete process based on the results of a sub query but its taking forever to run. I'm new to using Oracle, and am constantly looking for better ways of doing things and wondered if anyone could help......

delete FROM DELTA_OD001
WHERE order_no in
(SELECT Td.order_no
FROM IMPORT_OD001_CU STOMERS CD, DELTA_OD001 TD
WHERE CD.ORANGE_ID = TD.ORANGE_ID);

The volume of rows in Delta_od001 is approx 8.5million and will go up 250k per week. The number of records matched in the sub select if about 950k, and will be relatively constant each week, although will probably drop to about 700k on average.

Do you know of a better way to do this?
Is this query not working fine?

Always rebuild an index after large deletes for better performance
Oct 31 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2343
by: michaaal | last post by:
If I use a form to pass data (say, for example, through a textbox) the data seems to be limited to somewhat smaller amounts. What should I do if I want to pass a large amount of data? For example a list of 200 items?
10
2424
by: Digety | last post by:
We are looking to store a large amount of user data that will be changed and accessed daily by a large number of people. We expect around 6-8 million subscribers to our service with each record being approximately 2000-2500 bytes. The system needs to be running 24/7 and therefore cannot be shut down. What is the best way to implement this? We were thinking of setting up a cluster of servers to hold the information and another cluster...
4
3810
by: oshanahan | last post by:
Does anyone have ideas on the best way to move large amounts of data between tables? I am doing several simple insert/select statements from a staging table to several holding tables, but because of the volume it is taking an extraordinary amount of time. I considered using cursors but have read that may not be the best thing for this situation. Any thoughts? -- Posted using the http://www.dbforumz.com interface, at author's request...
5
4024
by: Olaf Gschweng | last post by:
We're new into DB2 and have some problem with DB2 8.1 (?) on a Linux system. We load some big tables of a DB2 database from files every day. We do a "DELETE FROM table" for each table and then we load the data by something like that: LOAD FROM "/pathto/artikel.data" OF DEL MODIFIED BY DATESISO CHARDEL0xbf SAVECOUNT 50000 MESSAGES "/pathto/artikel.msg" INSERT INTO artikel;
3
2853
by: Wayne Marsh | last post by:
Hi all. I am working on an audio application which needs reasonably fast access to large amounts of data. For example, the program may load a 120 second stereo sound sample stored at 4bytes per sample, which would mean over 40MB of data at a 44100Hz sampling rate. Now, what would be a good way to handle all of this data? Ideally, for the sake of my own sanity and the algorithms within directly functional portions of the code, I'd like...
2
5110
by: Dennis C. Drumm | last post by:
What is the best way to add several pages of text to a readonly TextBox? The text does not change and was created in a Word rtf document but could as easly be put in a ASCII text file. Can this be done using a resource or something? Can TextBoxes be attached to data sources other than database objects? Thanks, Dennis
1
5998
by: Bart | last post by:
Dear all, I would like to encrypt a large amount of data by using public/private keys, but I read on MSDN: "Symmetric encryption is performed on streams and is therefore useful to encrypt large amounts of data. Asymmetric encryption is performed on a small number of bytes and is therefore only useful for small amounts of data." There is not possibility to do it? I have tried to encrypt a 300kB file by RSA Algorithm, but I received...
8
1884
by: NAdir | last post by:
Hi, thank you for your help. My VB.Net application contains a document that the user can refresh at any time. The refresh works fine and needs to loop through few datatables (hundreds of rows). This works fine until I delete some rows in two tables. Just after the delete if I do the refresh there is a huge memory allocated and the time needed to perform the refresh increase, the memory and time continue to increase on each refresh until I...
7
10828
by: =?Utf-8?B?TW9iaWxlTWFu?= | last post by:
Hello everyone: I am looking for everyone's thoughts on moving large amounts (actually, not very large, but large enough that I'm throwing exceptions using the default configurations). We're doing a proof-of-concept on WCF whereby we have a Windows form client and a Server. Our server is a middle-tier that interfaces with our SQL 05 database server.
4
1930
by: bcomeara | last post by:
I am writing a program which needs to include a large amount of data. Basically, the data are p values for different possible outcomes from trials with different number of observations (the p values are necessarily based on slow simulations rather than on a standard function, so I estimated them once and want the program to include this information). Currently, I have this stored as a vector of vectors of varying sizes (first vector is...
0
9645
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
9480
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
10147
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
10090
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
9949
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
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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.