Deleting 1 row from a table takes too long...why?

We are running the following query...
delete gemdev.lu_messagecode where mess_code ='SSY'
and it takes way too long as there is only 1 record in this table with SSY as the mess_code.
SQL> set timing on;
SQL> delete gemdev.lu_messagecode where mess_code ='SSY';
1 row deleted
Executed in 293.469 seconds
The table structure is very simple as you can see below.
CREATE TABLE GEMDEV.LU_MESSAGECODE
MESS_CODE VARCHAR2(3) NOT NULL,
ROUTE_CODE VARCHAR2(4) NULL,
REPORT_CES_MNEMONIC VARCHAR2(3) NULL,
CONSTRAINT SYS_IOT_TOP_52662
PRIMARY KEY (MESS_CODE)
VALIDATE
ORGANIZATION INDEX
NOCOMPRESS
TABLESPACE IWORKS_IOT
LOGGING
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE(BUFFER_POOL DEFAULT)
PCTTHRESHOLD 50
NOPARALLEL
ALTER TABLE GEMDEV.LU_MESSAGECODE
ADD CONSTRAINT LU_ROUTECODE_FK3
FOREIGN KEY (ROUTE_CODE)
REFERENCES GEMDEV.LU_ROUTECODE (ROUTE_CODE)
ENABLE
ALTER TABLE GEMDEV.LU_MESSAGECODE
ADD CONSTRAINT MSGCODE_FK_CESMNEMONIC
FOREIGN KEY (REPORT_CES_MNEMONIC)
REFERENCES GEMDEV.SYS_CESMNEMONIC (CES_MNEMONIC)
ENABLE
My explain reads as follows.
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | DELETE STATEMENT | | | | 1 (100)| |
| 1 | DELETE | LU_MESSAGECODE | | | | |
| 2 | INDEX UNIQUE SCAN| SYS_IOT_TOP_52662 | 1 | 133 | 1 (0)| 00:00:01 |
Also in my AWR Sql Report I see this as well
Plan Statistics DB/Inst: IWORKSDB/iworksdb Snaps: 778-780
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 521,102 N/A 12.0
CPU Time (ms) 73,922 N/A 5.1
Executions 0 N/A N/A
Buffer Gets 2,892,144 N/A 3.4
Disk Reads 2,847,609 N/A 8.6
Parse Calls 1 N/A 0.0
Rows 0 N/A N/A
User I/O Wait Time (ms) 475,882 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 2 N/A N/A
Invalidations 1 N/A N/A
Version Count 1 N/A N/A
Sharable Mem(KB) 45 N/A N/A
Now, since the table only has 150 rows, and I am only try to delete 1 row, why is there so much disk read and why does it take 5 minutes to delete? This just weird. Does this have something to do with the Child tables?

Any triggers on the table?
If you trace the session, what statement(s) seem to
be taking all that time?
JustinWell I traced my session and I noticed that my query does take a while, but I also noticed several other queries that I was not running. Not too sure where it came from. Have a look below. It is a sample from my TKPROF utility report.
delete gemdev.lu_messagecode
where
mess_code ='SSY'
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.01 0.04 0 2 23 1
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.01 0.04 0 2 23 1
Misses in library cache during parse: 1
Optimizer mode: FIRST_ROWS
Parsing user id: 57
Rows Row Source Operation
1 DELETE LU_MESSAGECODE (cr=3446672 pr=3442028 pw=0 time=309363335 us)
1 INDEX UNIQUE SCAN SYS_IOT_TOP_52662 (cr=2 pr=0 pw=0 time=35 us)(object id 52663)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 35.87 35.87
select /*+ all_rows */ count(1)
from
"GEMDEV"."TBLCLAIMCHARGE" where "CONTRACT_FEE_MESS_CODE" = :1
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 10.53 44.95 381779 382893 0 1
total 3 10.53 44.95 381779 382893 0 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
1 SORT AGGREGATE (cr=382893 pr=381779 pw=0 time=44953436 us)
0 TABLE ACCESS FULL TBLCLAIMCHARGE (cr=382893 pr=381779 pw=0 time=44953403 us)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
db file scattered read 47795 0.03 37.87
db file sequential read 101 0.00 0.02
select /*+ all_rows */ count(1)
from
"GEMDEV"."TBLCLAIMCHARGE" where "FEE_INEL_MESS_CODE" = :1

Similar Messages

  • Deleting rows from a table

    COuld anyone tell me how to delete rows from a table which has millions of rows.
    TIA,
    Oracle user

    if you are deleting all the rows, use "truncate table" in sql*plus.
    or if you are deleting all but a handful of rows, then copy the rows you still want to a spare table, drop the original table, and rename the spare table back to the original table's name.
    hope this helps

  • Accessing BKPF table takes too long

    Hi,
    Is there another way to have a faster and more optimized sql query that will access the table BKPF? Or other smaller tables that contain the same data?
    I'm using this:
       select bukrs gjahr belnr budat blart
       into corresponding fields of table i_bkpf
       from bkpf
       where bukrs eq pa_bukrs
       and gjahr eq pa_gjahr
       and blart in so_DocTypes
       and monat in so_monat.
    The report is taking too long and is eating up a lot of resources.
    Any helpful advice is highly appreciated. Thanks!

    Hi max,
    I also tried using BUDAT in the where clause of my sql statement, but even that takes too long.
        select bukrs gjahr belnr budat blart monat
         appending corresponding fields of table i_bkpf
         from bkpf
         where bukrs eq pa_bukrs
         and gjahr eq pa_gjahr
         and blart in so_DocTypes
         and budat in so_budat.
    I also tried accessing the table per day, but it didn't worked too...
       while so_budat-low le so_budat-high.
         select bukrs gjahr belnr budat blart monat
         appending corresponding fields of table i_bkpf
         from bkpf
         where bukrs eq pa_bukrs
         and gjahr eq pa_gjahr
         and blart in so_DocTypes
         and budat eq so_budat-low.
         so_budat-low = so_budat-low + 1.
       endwhile.
    I think our BKPF tables contains a very large set of data. Is there any other table besides BKPF where we could get all accounting document numbers in a given period?

  • Prevent user from deleting rows from all tables in his own schema

    Hi,
    How can I prevent user from deleting rows in all tables in his own schema.
    I want the user to not able to delete rows from any existing or new tables that might be added in the future.
    The user does not have the "DELETE ANY TABLE" system privilege.
    Please advise.
    Thanks.

    Nowadays, I'd also avoid triggers (if possible).
    Sometimes, when I daydream, I'm rewriting a few applications that I've contributed to as a newbie, and I'm very ashamed of it nowadays.
    From what I've experienced, in retrospective, the emphasis on teaching 'Oracle stuff' has been lying far too much on PL/SQL row-by-row oriented processing instead of letting Oracle 'crunch' sets at once.
    Most of my debugging hours ended up in discovering one or more database triggers 'doing stuff automagically'.
    Another nice blogpost: http://rwijk.blogspot.com/2007/09/database-triggers-are-evil.html
    Regarding OP's question:
    I would just rethink/reconsider this requirement completely.
    Correctly implementing privileges and roles seems the best way to go, yes.
    Triggers? Nah...
    pre-post-edit, noticed thread got updated just before posting
    Don't know what you mean with 'namedropping', but I think it's legitimate to point other readers to interesting Oracle related opinions/articles that do have a technical background and lots of interesting examples.
    post dreaded OTN outage edit (from here)
    Again: I would just rethink/reconsider this requirement completely.
    Both trigger/vpd are being used to hide a design flaw here.

  • Deleting Rows From A Table After Running a Report

    I've created a report that inserts rows into a table on the asp page then calls a BI Publisher report to display the data. After running the report in BI Publisher I need to delete the rows from the table that had just been inserted. How is the best way to go about this in BI Publisher?

    The best way I know of would be to use an "afterReport trigger".
    An afterReport trigger fires after the XML output has been generated.
    Thanks,
    Bipuser

  • Deleting row from a table binded to a matrix

    Hi all
    i have a form with a matrix binded to a user table which is handled as a Master Data lines by UDO.
    i want to enable deleting lines from the table by selecting a row in the matrix and clicking a delete button.
    currently i'm handling the click event by usint the method DeletRow of the matrix object.
    when i press the Update button (UID = "1"). the fact that a row was deleted from the matrix does not affect the bounded table.
    my question is how in code can i cause the deletion of a row from the matrix to also be deleted from the database table?
    appreciate the help
    Yoav

    Hi Yechiel
    flushToDatasource make the following:
    Flushes current data from the GUI to the bounded data source using the following process:
    1)Cleans the data source.
    2)Copies each row from the matrix to the corresponding data source record.
    In other words: This method load data from Matrix to DataSource (but not to database)
    the next step is update database from userdatasource
    Note: You migth read sdk help for more information

  • Deleting rows from one table while filter condition lies into another table

    Hi All,
    I'm facing a problem deleting a row from a table where the condition lies in other table. To ealaborate the scenario further let's say I have two table T1 (transaction table) and T2 (Master Table). I want to delete a record from table T1 by checking some conditions lies in table T2.
    I tried with the below query but this query deleting records from both the table.
    DELETE FROM ( SELECT * FROM T1 top INNER JOIN T2 tp
    ON top.TID = tp.TID
    WHERE top.DEAL_SITE_ID = inputparameter1
    AND (TP.SEGMENT <>inputparameter2 OR tp.segment is not null));
    Here the record is getting deleted from both the tables but I don't want to delete data from my master table i.e table T2.
    Any help would be highly appreciated. Thanks in advance.
    Regards,
    Subhadeep

    SQL> select *
      2   from the_table;
    X          Y
    AA         a
    BB         a
    CC         a
    AA         b
    DD         b
    SQL> select *
      2   from the_table_2;
    X          Y
    AA         a
    BB         a
    CC         a
    SQL>  delete from
      2  (
      3  select *
      4  from the_table  t1 inner join the_table_2 t2
      5  on  t1.x = t2.x
      6  and t1.y = t2.y);
    3 rows deleted.
    SQL> select *
      2   from the_table;
    X          Y
    AA         b
    DD         b
    SQL> select *
      2   from the_table_2;
    X          Y
    AA         a
    BB         a
    CC         a

  • Indexing and categorization takes too long - why?

    I have set up a news publishing system where journalists access a folder and publish their news there using an xml form. So far so good.
    Readers of the news access a page with a km-navigation iview that points to a taxonomy folder. The query based taxonomy is set up to categorize news based on property-values chosen by the journalist in the xml-form. This also works as supposed.
    Lifetime (time based publishing) is activated for the folder the journalists access to publish their news. Corresponding start and end dates/times for setting lifetime for an article is set by the journalists. This also works as supposed.
    BUT: after saving each article the system takes awfully long to actually categorize the news and thereby make the articles visible for others than the journalists. It might be as long as half an hour or so. This also repeats itself every time an article is edited.
    I also feel that basic indexing of all other documents in the portal takes too long. I want all new documents to be indexed as soon as they're saved.
    Any tips?
    Henning

    I have set up a news publishing system where journalists access a folder and publish their news there using an xml form. So far so good.
    Readers of the news access a page with a km-navigation iview that points to a taxonomy folder. The query based taxonomy is set up to categorize news based on property-values chosen by the journalist in the xml-form. This also works as supposed.
    Lifetime (time based publishing) is activated for the folder the journalists access to publish their news. Corresponding start and end dates/times for setting lifetime for an article is set by the journalists. This also works as supposed.
    BUT: after saving each article the system takes awfully long to actually categorize the news and thereby make the articles visible for others than the journalists. It might be as long as half an hour or so. This also repeats itself every time an article is edited.
    I also feel that basic indexing of all other documents in the portal takes too long. I want all new documents to be indexed as soon as they're saved.
    Any tips?
    Henning

  • Deleting rows from a table matching values from an ascii file

    Hi All,
    I have an ASCII file with 12,000 lines. Each line represents a value (you may call this as bad data) that matches a database column value in table. I have to delete all the rows from a database table (~ 400,000 rows) where a column value matches the bad data value. Linux is the OS is where SQLPLUS client is installed and I can execure any SQL queries from this Linux server. Oracle DB server is 10g.
    Any input on how to do this will be helpfull to me. I am not a database programmer so if any details will be appreciated.
    Thanks

    Hi,
    That's going to be very slow (among other problems) if you don't have the bad data in a table. An index-organized table would probably be best.
    Assuming the data data are uinique strings, up to 30 characters long, and that you don't need any other columns, you can create a table like this:
    CREATE TABLE  bad_data
    (   bad_txt    VARCHAR (30)
    ,  CONSTRAINT  bad_data_pk  PRIMARY KEY (bad_txt)
    ) ORGANIZATION INDEX;SQL*Loader is one way of getting the data from the file (doesn't have to be on the database server; it can be on your client machine) into the table.
    Once you have a table, actually removing the rows from the big table might be as simple as:
    DELETE  big_table
    WHERE   column_a  IN
            (   SELECT  bad_txt
                FROM    bad_data
    ;

  • DELETED rows from internal table

    Hi Experts,
    If I delete row/s from an internal table
    using the command DELETE ADJACENT DUPLICATES,
    is there a way to get these deleted rows.
    Thanks in advance.
    Rose

    Hi roselie,
    1. ofcourse not.
    2.hence, before that,
      u can declare another internal table,
      similar to original,
      and use like this.
    3. ITAB1[]   = ORIGINALITAB[].
    regards,
    amit m.

  • How to delete rows from multiple tables when pressing button

    Hi, I'm wondering how do I delete a row from two different tables at the same time when I press the Delete button. Both tables have GROUP_ID as their primary key.

    Nevermind! I realized that I had "reset" before my process to delete from the 2nd table.

  • Select Data from BSIS table taking too long

    Hi
    I have to develop a report to give the  details of Extended Withholding Tax (EWT)  for a list of Expenses GL.
    Each expense GL is  linked to another Gl which is the EWT Tax GL Account. This is maintained in a Ztable.
    I havae wirtten the following code. It takes a lot of time to extract a data.
    This give me the GL i require
    SELECT * FROM ZSECCO_GL_EWT INTO CORRESPONDING FIELDS OF TABLE IT_GL
     WHERE BUKRS    = P_BUKRS
     AND   WT_QSCOD = P_QSCOD.
    Then I select  only the distinct documents No, from BSIS table  fro the hkonts  in the above internal table
    SELECT DISTINCT BUKRS GJAHR BELNR  FROM BSIS INTO CORRESPONDING FIELDS OF
    TABLE IT_BSIS_GL
     FOR ALL ENTRIES IN IT_GL
     WHERE BUKRS = P_BUKRS AND  HKONT = IT_GL-HKONT  AND GJAHR = P_GJAHR.
    Here I   once again select the   document details based on the document No. from above internal table
    This query takes a lot of time
    SELECT * FROM BSIS INTO CORRESPONDING FIELDS OF TABLE IT_BSIS
     FOR ALL ENTRIES IN IT_BSIS_GL
     WHERE  BUKRS = P_BUKRS AND GJAHR = P_GJAHR
        AND BELNR = IT_BSIS_GL-BELNR.
    Please Help

    Hi,
    Check note 992803; it could be that there is insufficient or missing index for BSIS table.
    Regards,
    Eli

  • Deleting Row from Advanced Table Region

    Dear Members,
    I have an OAF Page where I am using Advanced Table Region to display the data of a table.
    As soon as the page opens I am displaying one line in Advanced Table Region. In this region I have also given a button called ADD ANOTHER ROW +(using the feature of ADVANCED TABLE COMPONENTS, FOOTER, TABLE FOOTER , ADD TABLE ROW)+.
    So when user clicks on this button a new row will be added. Now if user wants to delete it how to achieve this.
    Kindly please help me in achieving this functionality.
    Many thanks in advance.
    Best Regards,
    Arun Reddy D.

    Hi Arun,
    First you need to create a button or image called Delete on your Advanced table region.
    Action Type : firePartialAction
    Event: delete
    Then In your CO PFR , write the below code
        if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))
          String rowRef = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
          OARow row = (OARow)am.findRowByRef(rowRef);
          row.remove();
        }Hope this helps. :)
    Thanks,
    SK
    Edited by: SK on Feb 9, 2011 5:21 PM

  • Mac-address-table takes too long to update on 4507R

    Hi,
    I'm trying to use spectralink phones, I have autonomous APs on seperate 2960s (and one on the 4507) - when the phones roam between the APs it takes very long for the mac address table to update on the 4507 even though there's uplink traffic.
    I have supervisor engine II+ (I read there are problems in previous versions)
    can anyone help?
    thanks

    Upgrading the switch could help avoid this problem..

  • Programatically Deleting Rows from a Table?

    I need to do some background cleanup tasks that include saving some data and deleting some data into the database. I'm trying to implement this in an extension framework class so that when 'real' application development begins, this background chore code will already be implemented.
    I'm creating view objects programmatically to retrieve data, but I don't know how to insert rows or delete rows. Delete statements in view objects fail since they aren't select statements, and code like:
    cleanupView.remove();
    raises "cleanupView is read-only" errors, since there aren't any entity objects defined for it (I assume, anyway).
    How can you insert and delete rows programmatically from a framework extension?

    My application of this technique is in a framework extension for generic housekeeping chores whose logic I'd like to keep out of the primary application. As such, it isn't possible to use EO and VO's declaratively.
    For anyone else who may travel this path, from the framework extension you can create views and execute DML statements like this: (In this case, in my AppModuleImpl extension)
    ViewObject myView = getDBTransaction().getRootApplicationModule().createViewObjectFromQueryStmt("myView","select * from mytable");
    myView.executeQuery();
    and when you're done:
    myView.remove();
    For DML, it's done by:
    getDBTransaction().executeCommand("delete mytable");
    getDBTransaction().executeCommand("commit");
    I concur that in 'normal' operations this isn't the best way, but rules can never be absolute.

Maybe you are looking for

  • RealTek onboard audio

    I've got my neo up and running and it's all great but the onboard audio.  The normal drivers won't install because "they are not intended for my platform" (makes sense) but the 64 bit specific drivers won't work either as windows claim "the necessary

  • Question about Xcode from experienced Mac users

    Hi, I am new to Macs.Recently I found an issues where the finder copy certain files such as .DS_Store whenever I access a network share. I tried to use a command through the terminal but it didn't work. I called apple to ask if there was any way I co

  • Why won't my trackpad work properly and the cursor will move on it's own and open windows and menu's randomly?

    I bought my Macbook Pro less than a year ago and the other night I was watching a TV show in itunes and I couldn't use the track pad. I was able to finally shut the Macbook down and the next morning I rebooted it. It was still acting weird and the tr

  • Bärte, Perücken, Brillen, Hüte etc

    Werte Forumteilnehmer Ich arbeite mit PSE 4 und da jetzt Fasching ist, wollte ich ein paar lustige Gesichtsveränderungen in Form von künst. Bärten, Perücken, Brillen, Hüten etc vornehmen. Mir ist schon klar, dass ich mit dem Freistellwerkzeug und Ebe

  • Making film compilation video. Importing help

    I'm new to Premiere Pro and editing in general.  I would like to make a video compilation that uses scenes from different films.  My sources will be various hi def MP4's and MKV's and AVI's of the film's themselves. When I import a film into Premiere