Deleting records from a versioned table slow.

Hi,
I have a problem the sql statement delete * from version_table slows down considerably as the number of history entries increase. 10g advises that an index should be created on the primary key column and creation time to improve performance. My question is this a viable option or is there an alternative. This has become apparent as java developer write units test to clear out data before and after running tests.
Cheers
Mark

Hi,
How significant is the change in performance as the number of history entries increase ? Since the delete statement is running without a where clause, I would expect a full table scan to be performed in both cases. If this is the case, then the amount of time to delete the same number of rows should remain fairly constant with only a slight increase in time. This is of course unless the size of the base table is also growing considerably from those extra historical rows, in which case the extra time would make sense in some cases.
Also, are the number of rows that are being deleted in both cases the same, or are the additional history entries due to inserts? If the extra rows are from inserts that I would expect the amount of time for the deletion to occur to increase, but only in proportion to the number of additional rows.
There is not too much else I can say without additional information. Feel free to file a TAR on this issue if this does not answer your questions.
Regards,
Ben

Similar Messages

  • Deleting records from a recursive table query

    Hi All,
    I have the follow query, I would like to ask for your help, please: we use recursive tables for various purposes and one of them may have 100,000's records.
    What would be the best approach to delete records from such a table?
    I was thinking about two below, but any additional one will be more than welcome as well:
    (1) I can DELETE FROM my_table WHERE my_table_id IN (SELECT my_table_id FROM my_table START WITH my_table_parent_id = X CONNECT BY PRIOR my_table_id = my_table_parent_id, but it means that I will run on my_table twice, no?
    (2) I thought also to create a Foreign Key of my_table_id REFERENCES my_table_parent_id, but then I am afraid it will effect DML commands on that table.
    Thank you in advance

    Hi,
    kdwolf wrote:
    ... (1) I can DELETE FROM my_table WHERE my_table_id IN (SELECT my_table_id FROM my_table START WITH my_table_parent_id = X CONNECT BY PRIOR my_table_id = my_table_parent_id, but it means that I will run on my_table twice, no?Sorry, I'm not sure whqt you mean by "I will run on my_table twice". Assuming you don't already have a foreign key constraint (as you described below) I don;t know any other way, let alone a more efficient way, to get the same results.
    (2) I thought also to create a Foreign Key of my_table_id REFERENCES my_table_parent_id, but then I am afraid it will effect DML commands on that table.You're right; a foreign key constraint always costs a little whenever you do DML. Someone who knows your application and your system as well as you do will have to decide if the benefit of having accurate, consistent data justifies that additional cost. If you're not sure, I suggest you add the constraint.
    One advantage of having a foreign key constraint is that you can create it with the "ON DELETE CASCADE" option. Then, if you simply say "DELETE FROM my_table WHERE my_table_patrent_id = X", all the descendants of those rows will automatically be deleted, exactly as you requested in (1) above.

  • How to delete records from dynamic internal table.

    Hi Experts,
    Need urgent help!!!
    Issue is with Dynamic internal tables.
    Below is code written by me :
    FORM select_query USING Lw_tabnam
                      TYPE  t682i-kotabnr.
      DATA :  lw_line  TYPE REF TO data,
              lw_line1 TYPE REF TO data.
        CREATE DATA Lw_line    TYPE (lw_TABNAM).
        ASSIGN      Lw_line->* TO   <WA_tbl>.
        CREATE DATA LW_LINE    TYPE STANDARD TABLE OF (Lw_tabnam)
                               WITH NON-UNIQUE DEFAULT KEY.
        ASSIGN      Lw_line->* TO <TBL>.
        SELECT * FROM  (Lw_tabnam)
                 INTO CORRESPONDING FIELDS OF TABLE <TBL>
                 WHERE (t_keys).
    Endform.
    code is working fine.
    here even the table name and where condition are dynamic,everything is fine upto this point.
    Now i have to delete some record from <TBL> based on some conditons.
         for ex : ( here lc_fieldname is KUNNR)
          loop at t_kunnr.
              lw_tabix = sy-tabix.
            Read table <tbl>
                    with key (lc_fieldname) = t_kunnr-kunnr ASSIGNING <wa_tbl>.
            If sy-subrc = 0.
            *Delete
            delete <tbl> from <wa_tbl>
    delete <tbl> index  lw_tabix.
            Endif.
         Endloop.
    The above delete statement doesn't work ,even we can't use index as it gives a syntax error " something related to "index is not allowed in standard table or hash table.
    Can you help me ab't how to delete records in Dynamic internal table?
    Other option that i am thinking of is to create a static table of type dynamic table.
    means, data itab type standard table of <tbl> .I know the syntax is wrong ,however is there any way to do this?
    Thanks in advance ,
    If you have any suggestion ab't this then do let me know.
    bye,
    Gaurav.

    Hi
    I wrote this code and it works fine:
    DATA LW_TABNAM(10) VALUE 'LFA1'.
    DATA : LW_LINES TYPE REF TO DATA,
           LW_LINE  TYPE REF TO DATA.
    FIELD-SYMBOLS: <TABLE> TYPE TABLE,
                   <WA>    TYPE ANY.
    CREATE DATA LW_LINES TYPE TABLE OF (LW_TABNAM)
    WITH NON-UNIQUE DEFAULT KEY.
    ASSIGN LW_LINES->* TO <TABLE>.
    CREATE DATA LW_LINE TYPE (LW_TABNAM).
    ASSIGN LW_LINE->* TO <WA>.
    DO 10 TIMES.
      APPEND INITIAL LINE TO <TABLE>.
    ENDDO.
    SY-TABIX = 4.
    DELETE <TABLE> INDEX SY-TABIX.
    WRITE SY-SUBRC.
    I hope it help you
    Max

  • Deleting records from Self-Referencing Table

    I am using this query to dodge the foreign key error when trying to delete a record from a table that has primary key and referencing foreign key in the same table. It works with smaller set of data but for a table with 400,000 records it fails with error
    : maximum recursion limit of 500 reached. I changed maxrecursion to 3267 and even 0. but no records were returned it infact went to infinite loop..
    Please help if u have an alternative solution othr than a cascade trigger(which I am already considering)
    WITH    q AS
            SELECT  id, siteUrl
            FROM    TestComposite
            WHERE   id = 42
                    AND siteUrl = 'site1'
            UNION ALL
            SELECT  tc.id, tc.siteUrl
            FROM    q
            JOIN    TestComposite tc
            ON      tc.parentID = q.id
                    AND tc.siteUrl = q.siteUrl
    select * 
    FROM    TestComposite
    WHERE   EXISTS
            SELECT  id, siteUrl
            INTERSECT
            SELECT  id, siteUrl
            FROM    q
    Thanks,
    J

    I am using this query to dodge the foreign key error when trying to delete a record from a table that has primary key and referencing foreign key in the same table. It works with smaller set of data but for a table with 400,000 records it fails with error
    : maximum recursion limit of 500 reached. I changed maxrecursion to 3267 and even 0. but no records were returned it in fact went to infinite loop..
    That is a questionable approach. Don't dodge table constraints. They have a reason to be there. Deep recursion is also doubtful approach.
    USE tempdb;
    GO
    SELECT * INTO Employee FROM AdventureWorks.HumanResources.Employee;
    GO
    ALTER TABLE Employee ADD constraint PK PRIMARY KEY (EmployeeID);
    ALTER TABLE Employee ADD constraint fkPK FOREIGN KEY (ManagerID) REFERENCES Employee(EmployeeID);
    GO
    SELECT * FROM Employee;
    GO
    -- Staff - no child records
    DELETE Employee WHERE EmployeeID = 283; -- (1 row(s) affected)
    -- Manager - child records
    DELETE Employee WHERE EmployeeID = 284;
    Msg 547, Level 16, State 0, Line 19
    The DELETE statement conflicted with the SAME TABLE REFERENCE constraint "fkPK". The conflict occurred in database "tempdb", table "dbo.Employee", column 'ManagerID'.
    The statement has been terminated.
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Deleting Records from engine DB tables

    Hi,
    In DEV ENV,the bam-dwupdater log file, the datawarehouse service is not able to find the instance with in: 737.
    It is constantly throwing error as : "Process with in [737] not found ", thus increasing the size of the log file.
    Is 737 is the project id of the application in FDI table
    From the engine db, the pprocinstance table is still containg 16K instances with processid as 737.
    We are thinking of clearing these records by runnning query manuallly.
    From which other tables we need to delete the records for the instances with the same processid?
    As we will use cascade delete, what is the parent-child relationship between the engine db tables??
    Is it advisable to clear the above records from pprocinstance table by running query?
    From where can i get the relationship, is there any oracle document on this?
    From where is this error coming repeteadly??
    Please advise.
    Regards,
    Shantanu
    Edited by: 789755 on Sep 15, 2011 6:53 AM
    Edited by: 789755 on Sep 15, 2011 6:55 AM

    The relevant code with comments:// Find out where the file pointer is pointing now
      long point = book_database.getFilePointer();
    // Read in everything beyond that point in the file
    // (You seem to assume it was pointing at record number row+1.)
    // (I see nothing to convince me that is true.)
      byte[] b = new byte[(int)book_database.length()-(int)point];
      book_database.readFully(b);
    // Move the file pointer to point at the record you want to delete
      book_database.seek(rowstart);
    // Write the "everything" over that records and the ones after it.
      book_database.write(b);
    // Set the length of the file to the right value, at least the right
    // value of what you actually wrote there.
    book_database.setLength(book_database.length()-(point-rowstart) );If you say that code is deleting the selected row and everything after it, then it follows that the file pointer is pointing at the end of the file when this code runs. A little bit of debugging code would test that hypothesis; you should see that the byte array contains zero elements.

  • Deleting records from internal tabl

    Hi All,
    Here i need delete records from one internal table, from another internal table. both contains same field as name1, so here , i need to delete records from t_itab , the records which are existed in t_itab1.
    first internal table t_itab contains
    vinesh01
    vinesh02
    vinesh03
    vinesh04
    second internal table t_itab1 contains
    vinesh01
    vinesh02
    here i need to delte t_itab1 entries from t_itab.
    regards,
    vinesh.

    Hi,
    try this code.
    first internal table t_itab contains
    vinesh01
    vinesh02
    vinesh03
    vinesh04
    second internal table t_itab1 contains
    vinesh01
    vinesh02
    loop at t_itab1.
    loop at t_itab.
    if t_itab-name1 = t_itab1-name1.
    delete t_itab.
    (OR)
    delete itab where t_itab-name = t_itab1-name.
    endif.
    endloop.
    endloop.
    regards.
    sriram.

  • Delete records from tableA which are not in tableB

    Table A contains milions of records which is the best way to delete records from tableA which are not in tableB
    delete from tableA where empno not in (select empno from tableb)
    or
    delete from tableA where empno not exists (select empno from tableb
    where b.empno=a.empno)
    any help

    Hi
    If you can do this, do with this:
    create table tableC
    as select a.*
    from tableA a,
    (select empno from tableA
    minus
    select empno from tableB) b
    where a.empno = b.empno;
    drop table tableA;
    rename table tableC to tableA;
    Ott Karesz
    http://www.trendo-kft.hu

  • Delete records from internal table

    hi all,
    i want to delete records from intenal table which are starting with a particular starting number .
    eg internal table
    10000
    20000
    90000
    91000
    92000
    88880
    i want delete the records starting with 9 i.e. 90000 91000 92000.
    Thanks in Adv
            RAJ

    You can test this piece of code.
    DATA:
    i_tab TYPE STANDARD TABLE OF mara,
    wa_tab TYPE mara.
    wa_tab-matnr = '1000'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '1001'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '1002'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '1003'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '2001'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '3001'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    wa_tab-matnr = '4010'.
    APPEND wa_tab TO i_tab.
    CLEAR wa_tab.
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Aug 8, 2008 4:49 PM

  • Delete records from multiple table

    Hi,
    I need to delete records from multiple tables using a single delete statement. Is it possible ? If so please let me know the procedure.
    Kindly Help.
    Thanks,
    Alexander.

    Hi Tim,
    Syntax of DELETE statement does not allow for multiple tables to be specified in this way. Infact, none of the DMLs allow you to specify table names like this.
    Technically, there are other ways of deleting from multiple tables with one statement.
    1. "Use a trigger":
    What was probably meant by this is that you have a driving-table on which you create a on-delete trigger. In this trigger, you write the logic for deleting from other tables that you want to delete from.
    This does mean a one-time effort of writing the trigger. But the actual DML operation of deleting from all the tables would be simply triggered by a delete on driving-table.
    2. Dynamic SQL:
    Write a PL/SQL code to open a cursor with table-names from which you want the data to be deleted from. In the cursor-for loop, write a dynamic SQL using the table-name to delete from that table.
    3. Using Foreign-Key constraint with Cascade-Delete:
    This I feel is a more 'cleaner' way of doing this.
    Having to delete data from multiple tables means that there is some kind of parent-child relationship between your tables. These relationships can be implemented in database using foreign-key constraints. While creating foreign-key constraint give the 'on delete cascade' clause to ensure that whenever data is deleted from parent-table, its dependent data is deleted from child-table.
    Using foreign-key constraint you can create a heirarchy of parent-child relationships and still your DELETE would be simple as you would only have to delete from parent-table.
    IMPORTANT: Implementing foreign-key constraints would also impact other DML operations that you should keep in mind.

  • Delete records from z-table

    Hi ,
    delete statement is not working .
    i am using the logic like this .
    loop at itab into work_area.
    delete z-table from work_area .
    endloop.
    but i am unable to delete the records from the z-table .
    could you please look into this.
    Thanks,
    kumar.

    hi suresh,
    <b>DELETE  dbtab FROM wa.</b>
    After the statement is executed, the sytem field SY-DBCNT contains the number of lines that were deleted (0 or 1).
    The Return Code is set as follows:
    SY-SUBRC = 0:
    The line was deleted.
    SY-SUBRC = 4:
    No line could be deleted since there was no line with the primary key specified.
    example:
    <b>
    DATA wa TYPE sbook.
    wa-carrid = 'LH'.
    wa-connid = '0400'.
    wa-fldate = '20010228'.
    wa-bookid = '00000003'.
    DELETE sbook FROM wa.</b>
    check this link:
    http://help.sap.com/saphelp_47x200/helpdata/en/a6/0c723c590a9f6fe10000000a11405a/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/a4/35ff395ef548e5add909b73ca12878/frameset.htm
    reward me if useful...
    Harimanjesh AN

  • I HAVE A SOURCE TABLE WITH 10 RECORDS AND TARGET TABLE 15 RECORDS. MY WUESTION IS USING WITH THE TABLE COMPARISON TRANSFORM I WANT TO DELETE UNMATCHED RECORDS FROM THE TARGET TABLE ??

    I HAVE A SOURCE TABLE WITH 10 RECORDS AND TARGET TABLE 15 RECORDS. MY QUESTION IS USING WITH THE TABLE COMPARISON TRANSFORM .I WANT TO DELETE UNMATCHED RECORDS FROM THE TARGET TABLE ?? HOW IT IS ??

    Hi Kishore,
    First identify deleted records by selecting "Detect deleted rows from comparison table" feature in Table Comparison
    Then Use Map Operation with Input row type as "delete" and output row type as "delete" to delete records from target table.

  • How do you delete records from table with data in a select option

    how do you delete records from table with relevant to data in a select option..how to write coding

    Hi,
    Try
    if not s_select_option [ ] is initial.
    delete * from table
    where field in s_select_option.
    endif.
    commit work.
    Be careful though. If select option is emty, you will delete the entire table.
    Regards,
    Arek

  • Deleting records from Z table via an ABAP

    Hello hoping someone can help me
    I am about to start writing an abap that will delete records from three seperate z tables that have been in there for over 18 months.
    Hoping that someone can give me a shove in the right direction to start me off as never had to do anything like this before.
    Iv had a search through the forum but cant seem to find what im after
    Thanks

    Hi,
    The below statement will do the purpose.
    DELETE zcustom FROM TABLE ITAB.

  • Deleting records from table MVER

    We are experiencing performance issues when adding data to table MVER.  We have data on there that is over 5 years old which could be deleted.  As we have not been able to find any standard program or process that carries out housekeeping on MVER we are considering writing an ABAP program to delete the records.   Has anyone had any problems when deleting records from MVER or does anyone know of any reason why we should not delete these records in this way ?

    Well, I wouldn't delet data from a standard SAP table based on information from the internete. I'd look at other alternatives.
    Are you maintaining custom indexes on this table?
    Are your database statistics up to date?
    Consider a databse re-org.
    I don't think simple inserts should cause a problem.
    Rob

  • Help needed writing trigger for deleting records from multipul tables

    i am trying to write a trigger which would help me delete the record from 3 different tables
    lets say i have table a , b and c
    i an trying to write a trigger which would help me delete the same record from table a and c.
    drop trigger az_zzz_trigger;
    create trigger az_zzz_trigger
    before INSERT or UPDATE or DELETE ON az_employ
    FOR EACH ROW
    BEGIN
    IF DELETING then
    delete from za_payroll
    delete from az_salary_audit
    end if;
    end;
    while executing this trigger all data of table za_payroll is delete.
    what should i do so that only the record which i delete from az_employ gets deleted from az_payroll and az_salary_audit

    872959 wrote:
    i am trying to write a trigger which would help me delete the record from 3 different tables
    lets say i have table a , b and c
    i an trying to write a trigger which would help me delete the same record from table a and c.
    drop trigger az_zzz_trigger;
    create trigger az_zzz_trigger
    before INSERT or UPDATE or DELETE ON az_employ
    FOR EACH ROW
    BEGIN
    IF DELETING then
    delete from za_payroll
    delete from az_salary_audit
    end if;
    end;
    while executing this trigger all data of table za_payroll is delete.
    what should i do so that only the record which i delete from az_employ gets deleted from az_payroll and az_salary_auditutilize appropriate WHERE clause

Maybe you are looking for

  • How can I set up a sustain pedal in Logic 9?

    I have scoured the forums and Logic Help pages for anything that can help me hook up my sustain pedal in Logic. I have a Korg Kontrol49 midi keyboard with two pedals hooked up to it; a "Switch" and "Pedal". In all my previous programs, such as Reason

  • Where is the "month" view on the calendar in iOS7?

    The subject is my question. What happened to the month view on the calendar in iOS7? I really liked my MONTH view. Mine is showing only 3 options: Today, Calendars, Inbox. I really liked being able to see what is scheduled for the month.  Now I have

  • One Custom Ringtone at a Time - That's all we get?

    Has anyone successfully loaded more than ONE custom ringtone onto their iPhone and had success using the additional tones? I bought three from iTunes and created one of my own. I'm only able to have ONE of these tones on the phone at any one time. If

  • Css auto center issue

    http://www.pmcgvideoportfolio.info/test.htm I have been following a tutorial from Adobe relating to "Working with Background Images and CSS - Part 3 Altering the Appearance of Your pages with Drop Shadows."  I think I have stayed pretty close to the

  • Import server: Undefined elements exception

    Hi, I do have a problem with the import server. I get ,'save-update map' structural exceptions in the import server. It complains about undefined elements, and if saved the update it works for one single XML file but other still fail with similar (ot