In bulk FORALL delete statement it requires a lot of time
HelloWhen I run block FORALL delete instruction it requires much time even to 10 lines deletion.so how to avoid this problem? I checked SGA_TARGET and max_size and PGA_TARGET cureent_size are the same for both. Is there is problem of memory?
Thanks in advance
Vaibhav
Please look at this:
http://psoug.org/definition/limit.htm
If you add the LIMIT 100 part to your query to collect your bulk / construction forall will treat 100 records per part.
This will avoid to fill with undo tablespace / PGA in memory.
There is also a weather of discussion to use 100 LIMIT or LIMIT 1000 (or MORE).
It depends on what your system can handle, if it is a declaration of production occupied, I would stick to a value of 100.
Reason for this, is that your request will not be a huge amount of PGA.
DECLARE
TYPE t_id_tab IS TABLE OF test.c1%TYPE;
l_id_tab t_id_tab := t_id_tab();
Begin
dbms_output.put_line(DBMS_UTILITY.get_time);
select c1 bulk collect into l_id_tab
from TEST where c1<=150000
LIMIT 100;
FORALL i IN l_id_tab.first .. l_id_tab.last
delete from TEST where c1= l_id_tab(i);
commit;
dbms_output.put_line(DBMS_UTILITY.get_time);
End;
We use this construction to load data into our warehouse and pushed the LIMIT 100 part during the test.
He did speed things up considerably.
(Risky!) something else is to do:
-- exclude table from archivelogging
ALTER TABLE TEST NOLOGGING;
-- execute plsql block
-- enable logging on the table
ALTER TABLE TEST LOGGING;
The risky part, is that you get incompatible in this way archivelogging because your losses are not recorded.
When you perform a restore of backup and want to roll forward until the last change in your archive logs, you won't miss these deletions, and your table is not consistent with the rest of your database.
In our warehouse situation that we don't mind, the data gets updated every night.
I hope this helps!
Robin
Tags: Database
Similar Questions
-
I made a script to check if some of the pictures are left.
In the past, it works fine, but now I noticed, that the script needs a lot of time to complete. The VCenter CPU load goes up to that time there.
Is this normal, that it takes so long? (37Hosts/670VMs)
$viserver = Connect-VIServer our_vcenter $allvm = get-vm $report = @() foreach ($snap in ($allvm | get-snapshot)) { $row = "" | select vmname, pstate, created $row.vmname = $snap.vm.name $row.pstate = $snap.powerstate $row.created = $snap.Created $report += $row } $body = $report | ft -auto | out-string $smtp = new-object Net.Mail.SmtpClient(”our_mailserver”) $smtp.Send(”admin@domain","admin@domain”, “Snapshots”, $body) Disconnect-VIServer -Server $viserver -confirm:$false
The cmdlet Get-Snapshot has some problems in PowerCLI 4u1.
____________
Blog: LucD notes
Twitter: lucd22
-
Can not build an installer, because it seems to have deleted the files required
LabVIEW does not locate the Installer source of a component necessary to build this installer. LabVIEW finally found the missing element in the following distribution:
The distribution name: NOR-DAQmx 8.6, disc 1
Last known installation path: C:\National Instruments Downloads\NI-DAQmx\8.6\NIDAQ860-1Search source for NOR-DAQmx 8.6, disc 1 Setup and build your installer again.
Visit ni.com/ask support request page to learn more about the resolution of this problem. Use the following as a reference:
CDK_Build_Invoke.VI.ProxyCaller > CDK_Build_Invoke.vi > CDK_Engine_Main.vi > CDK_Engine_Build.vi > CDK_Engine_PromptForMissingDist.vi
Loading information of product deployment
Loading information of product deployment
Adding files to install
Makes adding files
Preparing to build the deployment
Copy of the products of distributions
Copy distribution "OR-DAQmx 8.6, disc 2" of: C:\National Instruments Downloads\NI-DAQmx\8.6\NIDAQ860-2\ to: C:\LabVIEW\DAQ\Pentium4_Loggers\builds\Installers\Data worm 23a\ P4 Logger ".
Deployment of the completed buildingI think I must have deleted the files required from my C drive.
(Updated)
This is now fixed.
I managed to resolve this, by a combination of download OR-DAQmx 8.6.1 from the Web site of NOR and NOR-DAQmx 8.8 disc installation.
-
Takes a lot of time using forall delete
Hello
I'm insertions and deletions of rows via forall. Insert taking less time to insert the lines but by coming to
delete, it takes more than 5 days, a lot of time to remove 18.5 millions of rows in a table using forall.
the main table with 70 million lines.
the code is...
Get the ref_typ COLLECT LOOSE l_id_tbl LIMIT 10000;
Start
FORALL i in 1.l_id_tbl. COUNTY
INSERT INTO change_test (id,
history,
transaction,
date)
VALUES (seq.nextval,
"CHANGE_HIS,"
l_id_tbl (i),
SYSDATE);
exception
while others then
null;
end;
Start
FoRALL i in 1.l_id_tbl. COUNTY
DELETE FROM change_his
where id = l_id_tbl (i);
exception
while others then
null;
end;
end loop;
so please give me a good solution to remove lines of less than 5 days...
> exception when other then null;
Seriously. You want to REMOVE the lines, even if they did not get inserted? You don't care to if they are deleted?
-
Need help to set a DELETE statement.
I have a table that contains the records of files. Files come in a bouquet each week. So, we need to delete records from a table to the corresponding fields and load the table with up-to-date data.
In doing so, the DELETE statement takes a long time. Need help with this setting.
Here are the details.
(1) total number of records in the table: 23 million records.
(2) approximate records deleted each time: 500 K to 1.5 million.
(3) table is partitioned on a PERIOD key. That is, each partition will have the data for a given period.
(4) table is not indexed
(5) removal occurs on a combination of 2 fields (PERIOD + BATCH).
Here is the query and the plan:
===========================================================
SQL > EXPLAIN PLAN SET STATEMENT_ID = 'TSH' FOR
2 REMOVE / * + PARALLEL(DETAIL_UNKNOWN,10) * / u DETAIL_UNKNOWN
3 WHERE u.FLBATCHID = 'PCAFRINTERMAR1105' AND u.N_PER6 = 201214
4;
He explained.
SQL > SET LINESIZE 130
SQL > SELECT * FROM TABLE (DBMS_XPLAN. DISPLAY ('PLAN_TABLE', 'TSH', 'ALL'));
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Hash value of plan: 2400300449
----------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |
----------------------------------------------------------------------------------------------------
| 0 | DELETE STATEMENT. 596K | 12 M | 838 (9) | 00:00:12 |
| 1. REMOVE | DETAIL_UNKNOWN |
| 2. SIMPLE HASH PARTITION | 596K | 12 M | 838 (9) | 00:00:12 | 6. 6.
|* 3 | TABLE ACCESS FULL | DETAIL_UNKNOWN | 596K | 12 M | 838 (9) | 00:00:12 |
----------------------------------------------------------------------------------------------------
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Name of the query block / Alias object (identified by the operation identity card):
-------------------------------------------------------------
1 LED$ 1
3 LED$ 1 / U@DEL$1
Information of predicates (identified by the operation identity card):
---------------------------------------------------
3 - filter("U".") FLBATCHID '= 'PCAFRINTERMAR1105' AND 'U'." N_PER6 "= 201214)
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Projection of the column information (identified by the operation identity card):
-----------------------------------------------------------
2 - (cmp = 2, 3) "U". ROWID [ROWID, 10], "U". "N_PER6" [NO.22], 'U' "." " FLBATCHID ' [VARCHAR2, 20].
3 - « U ». ROWID [ROWID, 10], "U". "N_PER6" [NO.22], 'U' "." " FLBATCHID ' [VARCHAR2, 20].
27 selected lines.
===========================================================
Need your suggestions on how the query / table can be tuned.Hi Anand,
I wanted to check why your tkprof Watch report two executions of the statement:
call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Execute 2 2315.71 2480.17 0 3351 624489 611765
In fact, it there was only a single execution of the DELETE statement. The trace file begins with a call EXEC of any statement without call analysis
*** TRACE DUMP CONTINUED FROM FILE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_ora_241708.trc *** EXEC #1:c=20000,e=13996,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=32472879711702 ===================== PARSING IN CURSOR #2 len=68 dep=0 uid=72 oct=42 lid=72 tim=32472883567994 hv=740818757 ad='0' ...
TKProf aggregates this EXEC call with call EXEC of the DELETE statement because they have the same location of cursor (#1), he thinks it was the same cursor.
PARSING IN CURSOR #1 len=93 dep=0 uid=72 oct=7 lid=72 tim=32472889974030 hv=1242910589 ad='e5979d80' DELETE from detail_unknown where n_per6 = 201214 and FLBATCHID = 'PCAFRINTERMAR1105' END OF STMT PARSE #1:c=0,e=11462,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,tim=32472889974024 ... EXEC #1:c=2315710000,e=2480213492,p=0,cr=3691,cu=624489,mis=0,r=611765,dep=0,og=1,tim=32475370187626
So, the question about two executions is closed - there was only a single run.
The performance - 2315,71 seconds of time processor is absolutely huge for such amount of work. It looks like a bug.
First, I propose to check the time without compression. If your environment allows this kind of testing try to decompress the partition and re - run on unpacking data DELETION.
10.2 find the name of the partitionselect partition_name from dba_tab_partitions where table_name = 'DETAIL_UNKNOWN' and partition_position = 6
After that
alter table DETAIL_UNKNOWN modify partition
nocompress; alter table DETAIL_UNKNOWN move partition ; and run again the button DELETE.
What is the operating system on the server?
-
[CORRECTION] Optional clause in the DELETE statements.
Hello
I have always used the FROM clause in a delete statement.
Delete * from TableName.
Now I'm confused, is optional FROM?
Delete TableName is equivalent to Delete * from Tablename?user12022313 wrote:
HelloI have always used the FROM clause in a delete statement.
Delete * from TableName.
Now I'm confused, is optional FROM?
Yes, it is not compulsory.
>Delete TableName is equivalent to Delete * from Tablename?
It is equivalent, but would be better coded as
TRUNCATE TABLE TableName
-
Hi all
In the table of audit_organizations_test, I want to delete all records except those returned returned in the following select statement:
How can I dial a delete statement to do this?select * from audit_organizations_test ao where last_updt_date >= '01-jan-2008' union select * from (select * from audit_organizations_test ao where org_id not in (select aoo.org_id from audit_organizations_test aoo where aoo.last_updt_date >= '01-jan-2008') ) x where x.last_updt_date = (select max(ao1.last_updt_date) from audit_organizations_test ao1 where x.org_id = ao1.org_id
Thank you.Hello
delete from audit_organizations_test where rowid not in (select rowid from audit_organizations_test ao where last_updt_date >= '01-jan-2008' union select * from (select * from audit_organizations_test ao where org_id not in (select aoo.org_id from audit_organizations_test aoo where aoo.last_updt_date >= '01-jan-2008') ) x where x.last_updt_date = (select max(ao1.last_updt_date) from audit_organizations_test ao1 where x.org_id = ao1.org_id )
Concerning
Anurag -
Delete statement does not work properly
Hello
The following delete statement does not work correctly.
If I press DELETE will delete everything in the table of categories
I don't know whats wrong with it.
-Delete category line if there is not the infrastructure to support-
IF: P12_DFCY_SEQNO4 IS NOT NULL AND: P12_DFCY_CATG_C = "7" THEN
REMOVE FROM DFCY_CATG
IF NOT EXISTS (SELECT I.DFCY_SEQNO
OF DFCY_CATG C, DFCY_CATG_INFRSTRCTR I
WHERE C.DFCY_SEQNO = I.DFCY_SEQNO
AND: P12_DFCY_SEQNO4 = I.DFCY_SEQNO);
end if;
Thank you
MaryYou probably the where more clause:
DELETE FROM DFCY_CATG WHERE C.DFCY_SEQNO = :P12_DFCY_SEQNO4 AND NOT EXISTS(SELECT I.DFCY_SEQNO FROM DFCY_CATG C, DFCY_CATG_INFRSTRCTR I WHERE C.DFCY_SEQNO = I.DFCY_SEQNO AND :P12_DFCY_SEQNO4 = I.DFCY_SEQNO);
Not sure if this is the exact name of your column in the table, but that limit the scope of deleting just a record that you control.
Hope it will be useful,
Aaron
-
DEADLOCK DETECTED - DELETE statement - how/why he expects in SHARING mode?
Hello
I wonder if anyone can advise here. The environment is:
Microsoft Windows 2003 Server
Standard Oracle 10.2.0.4 Edition
We had a deadlock detected in our application on a customer site - I enclose the corresponding part of the trace file below. While we think we have found the reason for the deadlock (looks like it is due to a foreign key in cascade), I'm confused as the lock mode that is requested.
Here is the track information:
It seems to me like session * 481 * trying to do a deletion when the block is raised:Deadlock graph: ---------Blocker(s)-------- ---------Waiter(s)--------- Resource Name process session holds waits process session holds waits TX-00120012-00003b59 28 475 X 29 481 S TX-000a0029-0003508b 29 481 X 28 475 X session 475: DID 0001-001C-000F96B0 session 481: DID 0001-001D-00000079 session 481: DID 0001-001D-00000079 session 475: DID 0001-001C-000F96B0 Rows waited on: Session 481: no row Session 475: obj - rowid = 00014625 - AAAUYlAAIAAAAawAAo (dictionary objn - 83493, file - 8, block - 1712, slot - 40) Information on the OTHER waiting sessions: Session 481: pid=29 serial=18261 audsid=202192707 user: 51/info O/S info: user: SYSTEM, term: our_term, ospid: 5244:940, machine: our_machine program: our_exe.exe client info: GUI application name: app, hash value=3864155245 action name: our_action, hash value=3631189430 Current SQL Statement: DELETE FROM TABLE_1 T WHERE T.T_ID = :B1 End of information on OTHER waiting sessions. Current SQL statement for this session: UPDATE TABLE_1 T SET T.STATUS_ID = :B2 WHERE T.T_ID = :B1
and ask which mode (dynamique31) S .DELETE FROM TABLE_1 T WHERE T.T_ID = :B1
(also the 'no line' for lines didn't wait)---------Blocker(s)-------- ---------Waiter(s)--------- Resource Name process session holds waits process session holds waits TX-00120012-00003b59 28 475 X 29 481 S
I thought it would be in mode (e) X (clusive) (for the line being deleted). Actually Yes, I set up a test of fast and simple locking and mode (e) X (is) expected the final delete .Session 481: no row
So, am I misinterpreted the tracing information, or is the DELETE statement requesting the lock in mode S (Hare)? If this is the case, I'd appreciate a quick explanation of how/why it's...
Kind regards
ADOSI think we have almost the same reason to wait in S mode as in [single key application | http://books.google.pl/books?id=14OmJzfCfXMC&dq=oracle+wait+interface+practical+guide&q=unique+key+enforcement].
If two sessions want to insert the same key value, the other must wait, because the outcome depends on a commit / rollback of the first session. In the case of validation, session 2 must generate an error in case of cancellation, it must insert his record.In the test provided by ADOS, at session 1 there is an insert in session 2 - delete. The result of the delete operation depends, once again, commit or rollback in the first session. In the case of validation, it must remove, and cancellations, there is nothing to remove.
If the insert in session 1 has been replaced by the Update, there is no S lock but 'normal' eXclusive
Bartek
-
Hi - I created a photo album on my iMac with 241 photos in it, but my iPhone shows that 220 photos from the same album. I've deleted the album and created a second time, but got the same result, only 220 photos appear. I 2.9 GB available in iCloud, so it can't be the issue.
Al
Try the settings/iCloud and remove the synchronization. Wait a few minutes and then resynchronize.
Have you tried the signature to iCloud and then reconnect?
-
Attempt to delete pictures in my pictures and every time you send to trash, it makes a duplicate copy. How can I remove it without the computer by creating all these copies. Pls help. TKS.
original title: remove duplicate photosUnwanted copies have file names with
copy "prefix of"?Example: Copy of IMG_1455.JPG
If_yes_maybe the following tutorial, I wrote
for XP offers a few ideas:Here's how to reproduce the unwanted
copy of...Hold down your CTRL key and select multiple files...
Place your pointer over the selected group
(holding the key ctrl) and left click / drag
the group even just the slightest bit... now
release the mouse button.Oooops... multiple copies...
Maybe the following will help:
Sometimes most of the person who
trying to select multiple by holding the CTRL
or the SHIFT key down while clicking on the left to select the
image files.Copies are created when you are unable to
completely release the mouse button before
you move the pointer to another file. When a group
the selected file is dragged... even the slightest
release the mouse button will produce a bit...
copies of all the files previously highlighted.It's a little easier if you have your folder
Options set at single click... that way you can
select/deselect a file with just a mouse more
and you don't have to click. For multiples you
I have to keep... CTRL or Shift.Do not click on... no slip... no copy... maybe that of
your solution. To adjust the click...
Open a folder and go... Tools / folder
Options / General tab... Check... 'single click '.
To open an item"/ apply / OK.If you want to delete all the files in a folder
You can try the following:Reach... Edition / select all... or type... CTRL / has...
With all of the files selected... go... Drop / delete...
or press your delete key... or... click on the
Group and choose 'delete '.How do I find and remove unwanted 'copies '.
of your image files.Open the folder that the images are saved in and
on the left, click on the button 'Search' in your toolbar.(If you view the files from a montage
program and do not know where the record is... right
Click on one of the image files and the menu...
choose... Properties. The path to the folder will be
in the tab 'General' to 'Place').In the research pane select... "All files and folders".
In the "All or part of the file name" field. Come in...
a copy of
Now... on the left, click on the search"" button.
When the search is complete... go to... Edition / select all...
Then go to... Remove / delete.
You will see a dialog box asking if you are sure
you want to delete the files, click Yes.Now... on the left, click on the 'Back' button in your toolbar.
Now the remaining files should be your originals.
If you delete the wrong files... recover from
your basket now.Also see the following article:
Trouble fixing: stop Windows copy
Files accidentally when Ctrl-click selecting
http://www.howtogeek.com/HOWTO/Windows-Vista/fixing-annoyances-stop-Windows-from-copying-files-accidentally-when-CTRL-click-selecting/ -
Using the merge statement on support-compatible version table time invalid
Hello
just a simple question: is it possible to use a merge statement on a table of valid time support-compatible version?
For the next test, I get an ORA-01733.
(t1 is the version table compatible with time valid support t1 and t2 have the same structure: two fields: NAME and CODE (pk))
merge into < table1 > t1
with the help of < table2 > t2
on (t1. CODE = t2. CODE)
when matched, THEN update set t1.NAME = t1.NAME
where <>t1.NAME, t2.NAME;
Thank youHello
The sql merge operation does not currently work with versioned tables, with or without validtime. The optimizer of the merger results in insert/update statements on the underlying table for the _LT. As a result, instead of triggers that are created during the enableversioning are never triggered.
Kind regards
Ben -
Missing parenthesis on a delete statement
Hi all, I have a problem, this script does not work (I changed the names of tables and fields to my company privacy):
Start
delete from TABLE1
WHEN THERE IS)
Select G.FIELD1
, lpad (cm.c001, 6,' ') LIKE Field2
cm.c002 AS field3
cm.c003 AS FIELD4
m.codart AS sphere5
cm.c005 AS case FIELD6
cm.c006 AS FIELD7
nvl(cm.c007,0) AS FIELD8
of apex_collections cm
Join TABLE2 on c.FIELD2 = lpad c (cm.c001, 6,' ')
Join TABLE3 g on g.FIELD2 = lpad (cm.c001, 6,' ')
Join table 4 m on m.FIELD0 = rpad (cm.c004, 32,' ')
where g.FIELD10 = 'C '.
and g.FIELD2 = lpad (cm.c001, 6,' ')
and collection_name = "COLLECTION1.
order of seq_id
);
APEX_COLLECTION. CREATE_OR_TRUNCATE_COLLECTION ("COLLECTION1");
end;
because it gives me the error:
Report error-
ORA-06550: line 20, column 3:
PL/SQL: ORA-00907: lack the right parenthesis
ORA-06550: line 3, column 1:
PL/SQL: SQL statement ignored
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:
I do not understand where is the missing parenthesis...
Now, then you should do something like:
delete from TABLE1
WHERE (column, column, column, column, column, column, column, column))
Select G.FIELD1
, lpad (cm.c001, 6,' ') AS Field2
cm.c002 AS field3
cm.c003 AS FIELD4
m.codart AS sphere5
cm.c005 AS case FIELD6
cm.c006 AS FIELD7
nvl(cm.c007,0) AS FIELD8
of apex_collections cm
Join TABLE2 on c.FIELD2 = lpad(cm.c001,6) c
Join TABLE3 g on g.FIELD2 = lpad(cm.c001,6)
Table 4 m on m.FIELD0 = rpad(cm.c004,32) join
where g.FIELD10 = 'C '.
and cm.collection_name = 'COLLECTION1.
);
or
remove table 1 t
WHEN THERE IS)
Select null
of apex_collections cm
Join TABLE2 on c.FIELD2 = lpad(cm.c001,6) c
Join TABLE3 g on g.FIELD2 = lpad(cm.c001,6)
Table 4 m on m.FIELD0 = rpad(cm.c004,32) join
where g.FIELD10 = 'C '.
and cm.collection_name = 'COLLECTION1.
and t.key1 = g.field1
and t.key2 = lpad(cm.c001,6)
...
);
HTH
-
Difference between DELETE statements
Hello
What is the difference between these statements to delete
a. DELETE TABLE_NAME WHERE COLUMN_NAME =: B1
and
b. DELETE FROM TABLE_NAME WHERE COLUMN_NAME =: B1
Is there any problem with the performance?
Thank you
SKWelcome to the forum!
Whenever you post, provide your Oracle version 4-digit.
>
What is the difference between these statements to deletea. DELETE TABLE_NAME WHERE COLUMN_NAME =: B1
and
b. DELETE FROM TABLE_NAME WHERE COLUMN_NAME =: B1Is there any problem with the performance?
>
No difference. They are a single statement.It is probably more common to use the delete FROM statement, but Oracle itself doesn't care that one you use.
If you look at the diagram of the syntax in the SQL language Doc, you'll see that the word FROM is optional
http://docs.Oracle.com/CD/E11882_01/server.112/e26088/statements_8005.htm#i2112830 -
Hi forum members.
my original table extract
ITEM_ID QTY.
==========
1 10
1 0
2 5
2 0
3 15
3 0
4 0
5 0
6 0
MY QUESTION
How can I keep record unique column (ITEM_ID)
and removal of one of these folders that have count (Qty) = 2
and Qty = 0
REQUIRED RESULT
ITEM_ID QTY.
==========
1 10
2 5
3 15
4 0
5 0
6 0
concerning
teefuhehe
It is of the same SQL B-)delete from t where (ITEM_ID,QTY) not in (select ITEM_ID,max(QTY) from t group by ITEM_ID);
Maybe you are looking for
-
Closing and switching apps iOS on IPad Mini 4 10
I just upgraded 10 IOS on my IPad Mini 4 and I can find a way to close or switch to the applications that are running in the background. When I double tap on the Home button, it just put me back to the homescreen of IOS 10. I no longer see the appl
-
Hello I have a Pavilion dv7 - 2230ev running windows 7 complete edition x 64 after a new installation of the operating system. Although I could solve the problem with my buttons to quick launch to upgrade the BIOS of my product page and they are now
-
Windows closes programs as it is to melt! What are the causes that
When I close an Office program looks like it's melting! Even when I turned off the computer. What are the causes that? Thank you Deb
-
Dr. Watson Exception number: c0000005 (access violation)
I'm trying to solve my problem, which produce the PC restarts. I find the log file of the folder ""All Users Data\Microsoft\Dr Watson\ ". " Can pleas you check, if a problem can be read to him? Application exception occurred: App: (Pid = 1196) C:\Win
-
received a message that other users have logged on to my computer
When I rebooted my computer which i rarely stop/restart, I received a message stating that the other users are logged on and I wanted to go forward. There should be no one else except my admin account & a guest account. I ran MS Security Scan which