HOW TO MAKE AN UPDATE COMMAND MORE EFFICIENT

hI Everyone,
if we have round (10000000) records in a table and we want to update an attribute in this table. it takes sometime round 60 mins or even more, while both tables are indexed. Do anyone knows any magic to improve the efficiency.
Best Regards,

If you are using IN clause, try using exists.
AdinathWhy?
look at this
1) NOT IN vs NOT EXISTS:
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
  select *
    from dept
   where deptno not in (
                         select deptno
                           from emp
                          where deptno is not null
  Statement Id=12200   Type=
  Cost=2,64022111505165E-308  TimeStamp=03-05-07::13::40:08
       (1)  SELECT STATEMENT  ALL_ROWS
     Est. Rows: 1  Cost: 6
       (6)  MERGE JOIN ANTI
     Est. Rows: 1  Cost: 6
           (3)  TABLE TABLE ACCESS BY INDEX ROWID SCOTT.DEPT  [Analyzed]
           (3)   Blocks: 5 Est. Rows: 4 of 4  Cost: 2
                Tablespace: USERS
               (2)  INDEX (UNIQUE) INDEX FULL SCAN SCOTT.PK_DEPT  [Analyzed]
                    Est. Rows: 4  Cost: 1
           (5)  SORT UNIQUE
                Est. Rows: 14  Cost: 4
               (4)  TABLE TABLE ACCESS FULL SCOTT.EMP  [Analyzed]
               (4)   Blocks: 5 Est. Rows: 14 of 14  Cost: 3
                    Tablespace: USERS
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
  select *
    from dept
   where not exists (
                      select null
                        from emp
                       where emp.deptno is not null
                         and emp.deptno = dept.deptno
  Statement Id=100   Type=
  Cost=1,95696055847079E-307  TimeStamp=03-05-07::13::42:35
       (1)  SELECT STATEMENT  ALL_ROWS
     Est. Rows: 1  Cost: 6
       (6)  MERGE JOIN ANTI
     Est. Rows: 1  Cost: 6
           (3)  TABLE TABLE ACCESS BY INDEX ROWID SCOTT.DEPT  [Analyzed]
           (3)   Blocks: 5 Est. Rows: 4 of 4  Cost: 2
                Tablespace: USERS
               (2)  INDEX (UNIQUE) INDEX FULL SCAN SCOTT.PK_DEPT  [Analyzed]
                    Est. Rows: 4  Cost: 1
           (5)  SORT UNIQUE
                Est. Rows: 14  Cost: 4
               (4)  TABLE TABLE ACCESS FULL SCOTT.EMP  [Analyzed]
               (4)   Blocks: 5 Est. Rows: 14 of 14  Cost: 3
                    Tablespace: USERS
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/2) IN vs EXISTS
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
  select *
    from dept
   where exists (
                  select null
                    from emp
                   where emp.deptno is not null
                     and emp.deptno = dept.deptno
  Statement Id=100   Type=
  Cost=1,9569605606389E-307  TimeStamp=03-05-07::13::43:15
       (1)  SELECT STATEMENT  ALL_ROWS
     Est. Rows: 3  Cost: 7
       (4)  HASH JOIN SEMI
     Est. Rows: 3  Cost: 7
           (2)  TABLE TABLE ACCESS FULL SCOTT.DEPT  [Analyzed]
           (2)   Blocks: 5 Est. Rows: 4 of 4  Cost: 3
                Tablespace: USERS
           (3)  TABLE TABLE ACCESS FULL SCOTT.EMP  [Analyzed]
           (3)   Blocks: 5 Est. Rows: 14 of 14  Cost: 3
                Tablespace: USERS
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
  select *
    from dept
   where deptno in (
                     select emp.deptno
                       from emp
                      where emp.deptno is not null
  Statement Id=4203132   Type=
  Cost=2,64022111505165E-308  TimeStamp=03-05-07::13::44:16
       (1)  SELECT STATEMENT  ALL_ROWS
     Est. Rows: 3  Cost: 7
       (4)  HASH JOIN SEMI
     Est. Rows: 3  Cost: 7
           (2)  TABLE TABLE ACCESS FULL SCOTT.DEPT  [Analyzed]
           (2)   Blocks: 5 Est. Rows: 4 of 4  Cost: 3
                Tablespace: USERS
           (3)  TABLE TABLE ACCESS FULL SCOTT.EMP  [Analyzed]
           (3)   Blocks: 5 Est. Rows: 14 of 14  Cost: 3
                Tablespace: USERS

Similar Messages

  • How to make an update command efficient

    i have a table with with 891350 records, and the other table also have the same number or records, i have indexed both tables, and used this query to update the table,
    UPDATE tt A SET (A.SUBURB_FORM, A.DATASET_FORM, A.STATE_FORM)= (SELECT B.SUBURB, B.DATASET, B.STATE FROM bb B
    WHERE A.IDX=B.IDX AND B.STATE <>'XXX')
    WHERE EXISTS (SELECT NULL FROM bb C
    WHERE A.IDX=C.IDX AND C.STATE <>'XXX')
    tables are indexed on bases of idx, after 24 hours still it process, i think there might be some problem as before it was not taking that much long. please can anybody help to identify the issue.
    Thanks

    Prior to update, disable your indexes, After done!,
    you just enable them.
    hare krishna
    AlokI beg to defer with you. Disabling/enabling means you will be rebuilding indexes, which means you will be opening can of worms ;-)
    If the OP has downtime then easiest way is CTAS a new table, truncate the original table and populate using insert command along with the update changes with nologging option.
    Regards,
    Satheesh Babu.S

  • How to make an update command efficient, "it is urgent"

    i have a table with with 891350 records, and the other table also have the same number or records, i have indexed both tables, and used this query to update the table,
    UPDATE tt A SET (A.SUBURB_FORM, A.DATASET_FORM, A.STATE_FORM)= (SELECT B.SUBURB, B.DATASET, B.STATE FROM bb B
    WHERE A.IDX=B.IDX AND B.STATE <>'XXX')
    WHERE EXISTS (SELECT NULL FROM bb C
    WHERE A.IDX=C.IDX AND C.STATE <>'XXX')
    tables are indexed on bases of idx, after 24 hours still it process, i think there might be some problem as before it was not taking that much long. please can anybody help to identify the issue.
    Thanks

    Try:
    update (select A.SUBURB_FORM a_suburb, A.DATASET_FORM a_dataset,
            A.STATE_FORM a_state, B.SUBURB b_suburb, B.DATASET b_dataset,
            B.STATE b_state
            FROM tt A, bb B
            WHERE A.IDX=B.IDX AND B.STATE <>'XXX')
    set a_suburb=b_suburb, a_dataset=b_dataset, a_state=b_state;Also check you're not locked while updating.

  • How to make other people image more beautiful

    how to make other people image more beautiful?

    Well I think this is a good topic that has a lot of possibilities, I understand the OP is seemingly being vague but I think perhaps it might be grammatical more then lack of content.
    <br />
    <br />But there are techniques and different approaches to capturing the best qualities of the subject especially those of the human subject.
    <br />
    <br />cjmah
    <br />
    <br />the best way to go about this is post an image that you took of someone that you think can be improved and we can share with you techniques and ideas about equipment that you might like to have to help you achieve what you want to achieve.
    <br />
    <br />Her you save the image as a jpeg about 600 to 700 pixels on the longest length the go to this link
    <br />
    <br />http://www.pixentral.com you follow the instructions for uploading the file then you copy the text in the top text field and paste it into you message before you post it.
    <br />
    <br />Make certain you copy all the text including the link you know from and including this
    <a all="" the="" way="" to="" and="" including="" this="" /></a>
    <br />
    <br />It is a good subject.

  • How to make a Flash site more searchable

    Hi all,
    I was wondering how to make a Flash site more searchable in
    search engines. I'm guessing it is with meta tags, can anyone tell
    me which meta tags or if there are any other hints or tricks.
    Thanks,
    MediaMan5335

    Sad to say MediaMan5335, there's no real defined way to read
    a Flash movie file. Currently there are tips and tricks to do it,
    but all of them are merely patches to somethin long overdue and
    needed. Since Google is setting the trend, the best way to gain
    ranking is to follow their set of new rules.
    There were several ways to gain rankings, whether is be
    paying your way to the top, putting multiple links within your
    site, or placing tons of words that would be read by spiders.
    Google has multiple articles pertaining to Search Engine
    Optizmization or SEO. Head on over to Google and just type in
    "Google SEO" and you'll find a multitude of articles.
    Right now to answer your question, META KEYWORDS and META
    DESCRIPTION are your best tools for METAs. Having legit links
    INBOUND and OUTBOUND will help.
    Currently there a several companies working on allowing SWFs
    to be read by Search Engines. Hopefully this helps answer your
    question. SEO can be a daunting thing.

  • How to make live update stuff...

    HI, everyone..
    I would like to make the program for Live Update stuff like AntiVirus Norton.
    Please Let me know how to make it, and Could anybody tell me about algorithm of it?
    I have no idea how to do...
    Thank you...
    God bless you..

    I'm not sure whether you want, like, more elegant solution than this, but here it is:
    1. Make user execute your 'LiveUpdate' program.
    2. Make the program talk to your server or (if you don't have a server) CGI script using Networking API
    i.e. You can have a custom CGI script on Tripod.3. Determine whether there is an update
    4. If there is an update, download!

  • How to make an indicator takes more than one input

    Hello,
    I want to know how to make an indicator ( like gauge for example) response to more than one case strrcuture result. In other words, how the indicator can take more than one input and move based on different input values ( the arrow of the gauge moves to different angles basesed on the logic structure and not only to one degree).
    Thanks in advance,
     

    YES, you got it right Coastal !
    This is what i want to do,
    I dont know how to establish this output in the software, i am still learning LabVIEW.
    I put a merge block to join the outputs but it didnt work.
    check it in the attached VI file.
    I am sure it is an easy thing but I dont know how to implement it.
    Any help you provide is appreciated,
    Best wishes 

  • How to make system update with "use automatic configuration script" and an URL

    Hello,
    all our laptop using "use automatic configuration script" with an "accelerated_pac_base.pac" prxy setting.
    How can we make system update work with that ?
    And no way for us to by pass this proxy settings with
    Thanks

    I mean there is no general method which is capable of correcting all possible errors found by schema validation.
    For example if the validation says it expected to find an <organization> element or a <company> element but it found a <banana> element, there is no way to determine what repair is necessary.
    Anyway the requirement is fighting against the way things work in the real world. The purpose of validation is just to find out whether a document matches a schema. If it doesn't, then too bad. Send it back to be fixed or replaced. If you are having a problem because you repeatedly get documents which don't quite match your schema, then you need to train the users to produce valid documents or to give them tools which help them do that.

  • How to make an update in adobe player uppod.

    Player pack is inserted into the site http://like-film.ru . Help how to do automatic update to this site.

    Hi,
    I'm not sure I understand exactly, however, if you're saying that Flash Player installer is downloading from http://like-film.ru then it's not an official Flash Player download.  If this is not what you mean, please clarify and we'll try to help you.
    Maria

  • How to make Library Update work with XFL format

    Hi, all. When you keep your Flash file as a fla, it remembers where bitmap and audio files were so that if you edit the original file you can easily pull in that update by selecting the library icon, right-clicking, and selecting "Update." However, when you use xfl, that gets broken. I think the theory is that you are supposed to be able to dig through the library folder and be able to update the file there. However, in the case of audio files, there's not actually anything in the library directory, so you can't really do that.
    Is there a way that I'm missing to let you easily update bitmap and audio library assets with xfl? Is there a setting somewhere I should be setting that would enable my library assets to "remember" where they were imported from after the file is closed and reopened?  Note that I'm still on cs5.5 for the most part, because I feel like it's more stable than CS6 and definitely more stable than the CC versions, but I have also had this problem in CS6.

    "However, in the case of audio files, there's not actually anything in the library directory, so you can't really do that."
    I don`t remember how xfl was handled in older versions, but in CC the LIBRARY folder that you see inside your XFL File is an exact mirror of the LIBRARY Folder that can be found on your HD where the xfl file is located.
    So any Sound that you imported in your xfl file will be copied to that specific folder. And updating that file will automatically update it in your LIBRARY, so there is actually no need anymore to "update" your assets via the context command.
    (Windows 7-64bit)

  • How to make an update of millions of rows using only one commit statement?

    Hi, I need to execute a complex update statement over a partitioned table. I take advantage of partitioning: loop for each partition, do the update and make commit. Of that way I'm updating and then commiting around 600.000 rows.
    But some of our systems have Oracle Standar Edition version and partitioning is not supported. I want to make the same update without taking advantage of partitioning. That is my problem. I need to update around 15.000.000 of rows but if I try to make commit at the end, this update generates a lot of UNDO data and fails because there is not enought space for retention.
    I would like to know your suggestions. There is some way of avoid UNDO data generation? There is some way to execute commit automatically?
    Thanks for your support.

    >
    This is exactly what I was looking for. Its a shame is only available in 11.2.
    >
    Then you may be interested in 'Do-It-Yourself Parallelism' for your 10g version to accomplish the same thing very effectivelyl.
    See the 'Do-It-Yourself Parallelism' section of this article by Tom Kyte.
    http://www.oracle.com/technetwork/issue-archive/2009/09-nov/o69asktom-089919.html
    >
    In my book Expert Oracle Database Architecture , I spent quite a few pages describing how to perform batch operations “in parallel,” using a do-it-yourself parallelism approach. The approach was to break up a table into ranges, using rowids (see www.bit.ly/jRysl for an overview) or primary key ranges (see “Splitting Up a Large Table”). Although the approach I described was rather straightforward, it was always also rather manual. You had to take my “technique” and tweak it for your specific circumstances.
    >
    You really should get the book since it has ALL of the details. But the above quote has a link to that "Splitting Up a Large Table" doc and that doc shows how to do it.,
    http://www.oracle.com/technetwork/issue-archive/2006/06-jan/o16asktom-101983.html
    >
    Splitting Up a Large Table
    I would like to partition a range of values into balanced sets. Initially I figured that one of the analytics functions might be useful for this and decided to look into these and learn more about them. The question I had in mind was, "For an ordered list of values, how can we 'chop' them into ranges and then list the first and last value for each range?"

  • HOW TO MAKE ITEM UPDATABLE/NON-UPDATABLE DYNAMICALLY

    Hi ,
    I have a form with tabular layout on a multi record lock .
    From shows 20 records at a time and there is a scroll bar to scroll down .There is an item "flag" in the block which is not visible in the form with values "Y" or "N" .
    I need to make some text items in the record updatable when that record has "flag" ="Y" .Documentation say's we need to use set_item_instance_property to do that .
    I tried it in when-new-record-instance,pre-query and key-exeqry triggers with no luck .
    I would really appreciate if you could give me the following info
    1) How to loop through each record in a block to check value of "flag"
    2) Which trigger to use and level form,block etc .
    Thanks,

    Ram,
    Thanks for the update . Now it works . Another problem though ...
    My form displays 20 records at a time and I have a scroll bar .
    I need to change the background of Item to white when it is updatable and gary when it is not updatable .
    I've created a visual attribute and was using it with set_item_instance_property like this ..
    declare
    last_rec number;
    begin
    last_record;
    last_rec := :system.cursor_record;
    first_record;
    for i in 1 .. last_rec
    loop
    if :ANNUAL_FUNDS.flag != 'Y' then
    begin
    Set_Item_Instance_Property( 'EXP_FUNDS', CURRENT_RECORD, UPDATE_ALLOWED , PROPERTY_FALSE);
    Set_Item_Instance_Property( 'EXP_FUNDS', CURRENT_RECORD, VISUAL_ATTRIBUTE, 'VI_UPDATE');
    end;
    end if;
    if :system.last_record = 'TRUE' or i = last_rec then
    exit;
    else
    next_record;
    end if;
    end loop;
    FIRST_RECORD;
    end;
    When I took out the loop the way you've mentioned
    it's changing the background color of the item for the record in which cursor is in . Users want to look at the screen in a glance and go directly to the item which is updatable .
    Is there any way we can loop through all records once and change properties in one shot ?
    Sorry to bother you,
    Asha

  • How to make my game scroll more smoothly ?

    Hello! I'm new at Java, however I have some programming experience.
    I would like to make a tile engine. On the following link is an example of what I have so far:
    [link-->|http://members.home.nl/bramdenhond/testjava/]
    If you move your mouse over the area, the world scrolls.
    However, I don't think it scrolls smoothly enough.
    In the tutorial I was following, this technique was recommended for double-buffering:
            //** Update - Method, implements double buffering */
            public void update (Graphics g)
                  // initialize buffer
                  if (dbImage == null)
                        dbImage = createImage (this.getSize().width, this.getSize().height);
                        dbg = dbImage.getGraphics ();
                  // clear screen in background
                  dbg.setColor (getBackground ());
                  dbg.clearRect(0, 0, this.getSize().width, this.getSize().height);
                  //dbg.fillRect (0, 0, this.getSize().width, this.getSize().height);
                  // draw elements in background
                  dbg.setColor (getForeground());
                  paint (dbg);
                  // draw image on the screen
                  g.drawImage (dbImage, 0, 0, this);
            }For the timing, I'm using a Thread, as recommended in the tutorial:
             public void start ()
                  // define a new thread
                  Thread th = new Thread (this);
                  // start this thread
                  th.start ();
              public void run ()
                  // lower ThreadPriority
                  Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
                  // run a long while (true) this means in our case "always"
                  while (true)
                        // repaint the applet
                        repaint();
                        try
                              // Stop thread for 20 milliseconds
                              Thread.sleep (2);
                        catch (InterruptedException ex)
                              // do nothing
                        // set ThreadPriority to maximum value
                        Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
               }I was wondering if someone if this is indeed the best approach, and if there are
    any alternatives.
    Thanks!

    Hi all,
    I've changed this source code so I can move the character from bottom to up but scrolling background is up to bottom. How I can change this class for scrolling background from up to down and not viceversa?
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.image.BufferedImage;
    import java.awt.Image;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.MediaTracker;
    import java.awt.Toolkit;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.Timer;
    public class JAniDemo {
      private BufferedImage biBackground = null;
      private Toolkit tk;
      private JFrame f;
      JAniDemo(){
        tk = Toolkit.getDefaultToolkit();
        f = new JFrame("AniDemo 1.0");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        loadBackground("C:\\image.png");
        myPanel p = new myPanel(biBackground);
        f.add(p);
        f.pack();
        f.setVisible(true);
      private void loadBackground(String fn){
        Image im = tk.getImage(fn);
        MediaTracker mt = new MediaTracker(f);
        mt.addImage(im,0);
        try{
          mt.waitForID(0);
          biBackground = new BufferedImage(800, 641, BufferedImage.TYPE_INT_RGB);
          Graphics2D g2 = biBackground.createGraphics();
          g2.drawImage(im, 0, 0, null);
          g2.dispose();
        }catch(InterruptedException e){
          System.out.println(e.toString());
      public static void main(String[] args) {
        new JAniDemo();
      class myPanel extends JPanel implements ActionListener{
        private BufferedImage background;
        private BufferedImage bi = null;
        private int upperCorner = 0;
        int width;
        int height;
        myPanel(BufferedImage bg){
          super();
          background = bg;
          width = background.getWidth()/2;
          height = background.getHeight();
          bi = background.getSubimage(0,upperCorner,width,height);
          setPreferredSize(new Dimension(width, height));
          Timer t = new Timer(25, this);
          t.start();
        public void actionPerformed(ActionEvent e){ 
          upperCorner -= 1;
          if(UpperCorner >= height) UpperCorner = 38;  // adjust to make rollover seemless
          bi = background.getSubimage(0,UpperCorner,width,height);
          repaint();
        public void paintComponent(Graphics g){
          g.drawImage(bi, 0, 0, this);
    }Please see this changes of original source code:
    bi = background.getSubimage(0,upperCorner,width,height);
    width = background.getWidth()/2;
    if(UpperCorner >= height) // for vertical
    upperCorner -= 1; // for up to down scrolling
    Can you help me? Thanks.
    Regards.
    Edited by: Rapworld on Jun 9, 2010 11:19 AM

  • Form function security (how to make form Updatable)

    Hi...friends...
    I have one standard oracle form. Data of that form is updatable in 11.5.7 instances...I can insert,update and delete.
    But, we had upgraded Apps to 11.5.10...so, now the same form data is not updatable..I can insert, but cant delete or update...
    So, is there any thing like form function security attached with that form or responsibilities in previous version... which are not in new 11.5.10 ??
    How can I make that form contents updatable through Sys. Admin. concept.
    (not through Form Builder Design)
    Thanks in advance....

    Thank you guys..
    actually, it was a bug with 11.5.7 oracle versions specific to one check box value.
    it was treating check box values as,
    i) checked then 'Y
    ii) Null then 'Null' ------- the problem was here...due to null, query was not fetching data and that form is having flag which understands only 'Y' or 'N'
    iii) not checked then 'N'
    anyway thanks to u all...

  • How to make small updates to a website

    Hi all,
    Let's say you make a website and then realize that you want to add or adjust just one of the photos in it. LR will need to remake the entire site from
    scratch (slow if you have a lot of photos in it). PS on the other hand has always been very clever about just adding or updating the site to include the new or changed photo. Is there a trick to get LR to be this clever?
    thanks for any thoughts on this,
    foster

    > Yes, I see your point about it not being intended for managing sites etc.
    > I'm just not sure how to use the website module effectively.
    > My workflow before LR was to do all my adjustments in nikon-capture or PS
    > and then export everything to jpg. And then I'd get PS to make my website
    > collections of images from those jpg files. I was hoping that with LR, I
    > could avoid doing a separate export of everything to jpg.
    Yes, you can use LR to upload directly to the website, but neither PS nor LR
    are website management applications, so you will probably want to add such
    an application to your workflow. I use Dreamweaver, but others will work.
    It is common practice to have a copy of your entire website on your local
    machine. Using that model, you could use LR to create the web collection
    and copy to the folder in the local machine (just set the destination folder
    to the local copy of the web site). Then use your web application to a)
    link the new collection to the rest of the website, and b) sync the local
    copy with the online website, which will upload all new files. If you later
    decide to modify a single photo, then sync again using the web management
    application. Of course, that's just one possible solution, but any good
    solution will likely include a web management application.
    Best,
    Christopher

Maybe you are looking for