Executions of dynamic query taking a long time

Dear all,

During the race the query below, it takes a long time to execute.

[code]

DECLARE

statement varchar2 (1000);

BEGIN

FOR c1 IN (SELECT tenant_id FROM tenant WHERE tenant_id! = 0)

LOOP

FOR c2 IN (SELECT alignment_id FROM customer_alignment WHERE affiliation_id IS NULL AND tenant_id = c1.tenant_id)

LOOP

FOR c3 IN (SELECT vw.affiliation_id, vw.customer_id, vw.alignment_id, ca.customer_alignment_id

OF ca_primary_address_vw vw, ca customer_alignment, WHERE ca.affiliation_id IS NULL

AND ca.alignment_id = c2.alignment_id

AND ca.customer_id = vw.customer_id

AND ca.alignment_id = vw.alignment_id

)

LOOP

Statement: = "UPDATE customer_alignment SET affiliation_id ='|" C3.affiliation_id | |' where customer_alignment_id =' | C3.customer_alignment_id;

execute immediate (statement);

END LOOP;

END LOOP;

END LOOP;

END;

[/ code]

Can you please help me on this issue.

I use the version of Oracle 11 g.

Thanks a lot for your help.

Miriam.

Never perform a treatment by data line. SET the computer base. Direct use of the joints and cut single SQL. Your condition can be obtained by using the merge statement.

merge into customer_alignment c
using (
        select vw.affiliation_id
             , ca.customer_alignment_id
          from customer_alignment c
          join tenant t
            on t.tenent_id       = c.tenent_id
           and t.tenent_id       != 0
           and c.affiliation_id is null
          join customer_alignment ca
            on ca.alignment_id  = c.alignment_id
           and ca.affiliation_id is null
          join ca_primary_address_vw vw
            on ca.customer_id   = vw.customer_id
           and ca.alignment_id  = vw.alignment_id
      ) t
   on (
         c.customer_alignment_id = t.customer_alignment_id
      )
 when matched then
 update
    set c.affiliation_id = t.affiliation_id;

Tags: Database

Similar Questions

  • Query taking a long time to run

    Hello

    I have a query that takes a long time to run. There are 191 000 records. This is static data only. This is the query.


    SELECT X_FIRST_NAME,
    X_LAST_NAME,
    X_MIDDLE_NAME,
    X_MEMBERSHIP_ID,
    X_ASSOCIATE_ID,
    X_MEMBER_KY,
    X_MEMBER_EXP_DATE,
    X_JOIN_CLUB_DATE,
    X_MEMBERSHIP_KY,
    X_ADDRESS1,
    X_ADDRESS2,
    X_CITY,
    X_STATE,
    X_ZIP,
    X_DELIVERY_ROUTE

    OF Canceled_Customers S
    WHERE THERE ARE
    (SELECT 'Y' FROM Canceled_Customers WHERE)
    (By SELECTING COUNT (P.X_MEMBERSHIP_KY) IN Canceled_Customers P)
    WHERE P.X_ADDRESS1 = S.X_ADDRESS1
    AND P.X_ADDRESS2 = S.X_ADDRESS2
    AND P.X_CITY = S.X_CITY
    AND P.X_STATE = S.X_STATE
    (AND P.X_ZIP = S.X_ZIP) > 1);


    Thank you

    Kelly

    Kelly wrote:
    I'm trying to capture duplicates. However, only the address information will be duplicated.

    For example:

    There might be a Jody Smith and Tim Smith with different Membership_Ky with the same address. I need to find these documents.

    Hi Kelly,

    Then you can try this statement instead, which uses only a full table on your table scan:

    select x_first_name
         , x_last_name
         , x_middle_name
         , x_membership_id
         , x_associate_id
         , x_member_ky
         , x_member_exp_date
         , x_join_club_date
         , x_membership_ky
         , x_address1
         , x_address2
         , x_city
         , x_state
         , x_zip
         , x_delivery_route
      from ( select x_first_name
                  , x_last_name
                  , x_middle_name
                  , x_membership_id
                  , x_associate_id
                  , x_member_ky
                  , x_member_exp_date
                  , x_join_club_date
                  , x_membership_ky
                  , x_address1
                  , x_address2
                  , x_city
                  , x_state
                  , x_zip
                  , x_delivery_route
                  , count(*) over (partition by x_address1, x_address2, x_city, x_state, x_zip) cnt
               from canceled_customers
           )
     where cnt > 1
    

    Note: not tested.

    Kind regards
    Rob.

  • Query taking a long time to 12 c

    Dear all,

    We have a query that returns no output in 12 c. but same query gives output with in 2 seconds in the Database 11 g.

    Select a.id_place as id_place1, b.id_place as id_place2, minors (a.id_place) as minors1, minors (b.id_place) as ss_city_place_temp1 minors2 an inner join b on b.id_place_name ss_city_place_temp1 = a.id_place_name and b.id_place! = a.id_place and b.fl_active = a.fl_active and b.id_low_nbr = a.id_low_nbr and b.id_high_nbr = a.id_high_nbr and b.id_useing_area = a.id_useing_area and b.cd_side = a.cd_side and b.id_sub_ City = a.id_sub_city where a.id_city = 84 and a.fl_active = 'Y' order of a.id_place_name, a.cd_side, a.id_low_nbr, a.id_place;

    If I remove the order by cluase, its giving out in 12 c.

    I collected stats for the table. but no use.

    compared to 11 g, 12 c has more SGA.

    Please help me find the problem.

    Thank you and best regards,

    REDA

    problem solved,

    I think that his bug in 12 c,.

    After you change the settingoptimizer_features_enable='11.2.0.3' , its working fine.

    Thank you

    REDA

  • V10.11.3 OSX El Capitan taking a long time to open

    Why after update to OSX El Capitan v10.11.3 its taking a long time to open?

    Do you mean that it takes a lot of time for your computer to boot?  There could be several reasons for this.  Start by going to http://www.etresoft.com/etrecheck , download and run EtreCheck, copy paste here the status report.  It goes we will see what is currently on your system, and if there is something on this issue causing the extreme slowness of start-up, we see and advise you on what to do next.

  • Query takes a long time

    Hi Experts

    I'm using Oracle 11 g, I use under delete query to remove records of staging table.

    under query takes a long time (ranging from 1 hour, even there is no record to delete.

    I created payment_id indexes also did not help.

    delete from siebelwb.stg_p where payment_id not in (select * from siebel.s_src_payment)

    I know NOT of IN is degreding performace, is there another way to write above request so that we can remove them in NOT IN use.

    Try to use NOT EXISTS clause...

    Also you inner query must match the payment_id with query parent then here's the example query...

    removal of siebelwb.stg_p where THERE is NO payment_id (select 1 from siebel.s_src_payment where s_src_payment.payment_id = stg_p.payment_id)

  • I have tried, using the, trial version, creative, cloud, I, signed, until and started, the, download, download, is taking a long time, so, I, decided to cancel, she and buy, year, plan, pay, mont hly., I, started, download, creative, cloud, once again, bu

    I, tried, using the, trial version, creative, cloud, I, signed, until and started, the, download, download, is taking a long time, so, I, decided to cancel, she and buy, year, plan, pay, mont hly., I, started, download, creative, cloud, once again, but, downloading, was interrupted, by, ma, firefighters dau, by inserting, key usb, peripheral, in , the, USB port. , Could, not, I believe, downloading, I, signed, in, adobe, and now, tells me, that I, a, 30, day, trial, My, account, shows, that I have, I, p helps, my, first of all, every month, slice, but, I can only use a, trial, version, who, says, goes, e arentheses, 30, days., which can, I, do, for, get, the full, each year, the intention, version?

    Jacobm51486856 please see in Sign, activation or connection errors. CS5.5 and later for more information on how to resolve the error of connection that prevents your membership being authorized.

  • dynamic table takes very long time to compile

    Hello

    in a small program, I need to create a wide range:

    FIXED-SIZE ARRAY:
    [27] Char hash [26] [999] [99] [16];

    But not in all cases, the last item in the hash table has a value (string
    15 bytes), so I want to create a dynamic array to save memory.

    TABLE SIZE DYNAMICS:
    char * hashtable [27] [26] [999] [99];
    .......
    If (strlen (hash_string)) hashtable [a] [b] [c] [d] = malloc (sizeof (char) *)
    (strlen (hash_string) + 1)) ;

    .......

    In debug mode:

    If I compile the program with the array of fixed size, all working properly and
    the program runs immediately

    If I compile the same program with the table dynamically (and using malloc)
    It really takes time to compile. It seems that the program freezes,
    But if I wait quite a long time (several minutes), the program runs

    I am using CVI 2009

    Any ideas why it takes so long if I use dynamic memory?

    Thanks in advance,

    Norbert Rieper
    Bremerhaven

    When CVI compiles the file in a configuration of debugging with debugging level value Standard or extended, then we allocate data protection user to track the State of each pointer in the table. For each of the pointer values 69 million that we allocate data to add to your executable file to control execution. These allowances are initially the apparent blow.

    There are several ways to prevent CVI to distribute all of these additional data.

    (1) change the level of debugging "no run-time checking.

    (2) change the base type of the array of ' char *' to 'size_t '. You must also add a cast to all the references to the elements of the array.

    (3) select it's Enable. Obj option' option for the file that contains the definition of the table. This turns off debugging for this .c file.

    3 (b) move the declaration of the array to its own .c file and the option "Enable.obj" what .c file instead of the .c file that contains all the source data that uses the table.

    Although you need only 70 MB for dynamically allocated strings, you must always 265 MB to store the array of pointers to 69 million.

    -Michael

  • Taking a long time to power laptop

    Hi all

    My laptop (HP ENVY 17 - j005tx Notebook) when to stop only takes a few seconds, but it can take up to 5 minutes to be able to...

    At first I thought some service or program took a long time to stop, I installed Windows 8.1 SDK Performance Toolkit to try to identify a culprit. run the command "shutdown - traceFlags BASE + DIAG + LATENCY - noPrepReboot xbootmgr-trace" and the generated trace succeffully.

    I noticed that the notbook was restarted in a matter of seconds...

    Anyway, I proceeded to analyze the trace file using the wpa.exe anf program cannot find any program or service taking much time to stop!

    SO, I now understand the operating system Windows stops well even if the laptop is very long take-off power.

    Someone at - it suggestions?  I have installed NVIDIA driver 337.88 and found another thread here where they suspected this version of the driver has not been tested by HP and after they have applied it their judgment of the laptop slower than usual--is this somehting, perhaps to look at...

    I am currently downoading sp63414.exe NVIDIA driver for my laptop - should I uninstall my current driver and applies HP?

    Jim

    Laptop HP ENVY 17-j005tx, HP ENVY 27 - k001a, HP ProLiant MicroServer Gen8 G2020T, HP MediaSmart EX495 Server tilt, HP MediaVault 2020, HP ENVY 120 AiO Printer

    Thank you visruth...

    What I've tried is run "msconfig" and boot into "safe mode", restarted, then stop, stop was back to normal again.

    Then revived "msconfig" disabled all Microsoft Services, judgment and yet all fed off the coast as usual (soon after).

    Then restarted and re-enabled all services using "msconfig".  Disabled the following services, choose these particular that I'm not sure why they should be executed and some do not know what they are...

    rebooted and then stop and everything stop and power off was normal...

    It seems that one of these services is at the origin of the power off to take a few minutes...

    I suspect the bluetooth services, GSService, or IconMan_R, or even the genius of Netgear...

    Funny enough I did uninstall netgear genius a few weeks ago and see for some unknown reason, that the Service is still there? Hmm...

    Jim

  • MacBook Pro (13-inch, late 2011) taking a long time to start

    Hey everybody,

    I have a Macbook Pro (13 inch, late 2011), which takes a long time so that it starts about 1 min. This should automatically start since I have an SSD. Right? Specs are below:

    2.4 Ghz Intel Core i5 processor

    8GB memory

    Boot disk (my hard drive name)

    Intel HD Graphics 3000 512 MB graphics

    500GB Solid State hard drive

    I reboot mac, remove all items from the startup items, reset the SMC. What else is there to do?

    You have installed TRIM?

    Ciao.

  • Select the query takes a long time to run the second time

    Hi all

    I have Oracle 11 GR 1 material in windows server 2008 R2.
    I have a few tables with 10 million documents. When I run the select query to the tables of first time, it gives me a result in 15 seconds, but if I run the script even twice in the same session, I get the result in 15 minutes to complete...

    Why it's happening? What can be the solution for this?

    Thank you and best regards,
    Vikash jain (DBA Junior)

    What I know is that this feedback from cardinality generates more problems than improving the performance is, in fact, its main objective. But first look at which is was written in the link I posted above

    "Return of cardinality was introduced in the Oracle 11 g database 2. The purpose of this function is to automatically improve plans for queries that are executed repeatedly, _For that the optimizer does not estimate the cardinalities in the properly_ plan"

    If the cardinality feedback kiks in your case it is certainly because you do not have an exact statistics. Get the command the explain plans that I have shown you with the E-lines and A-lines (lines estimates and actual lines) and see where things are poorly estimated.

    If you want to disable the cardinality feedback then add the indicator according to your request

    /*+ opt_param('_optimizer_use_feedback','false') */
    

    Best regards

    Mohamed Houri
    www.hourim.WordPress.com

    Published by: Mohamed Houri on November 22, 2012 02:11
    Published by: I was looking for the exact indication of how do I deactivate the cardinality feedback and I foud in an ot the Dominic post in otn :-)

    Published by: Mohamed Houri on November 22, 2012 02:15

  • Recycle Bin taking a long time to display confirm delete

    Then, when I right click > Recycle Bin empty, I could 5 to 15 seconds for the confirmation dialog to appear before allowing me to delete what was there, even if it is a single file.

    If I open the trash, it can also take some time to load.

    It seems windows knows how many files, the discrepancy between the loading of confirmation is reduced to normal.

    I have the latest Windows.

    RESOLVED:

    It turns out my hunch was right, I did a few tests every few hours.
    Whenever I had my on and not running outside, he crawls.
    Whenever I had my cut outside or not unplugged, no lag.

    I guess that's just something with the way windows checks the files to delete because he wanted to check if my outside was marked for deletion, even if there are no files. It would be nice if Microsoft should fix this but it's not exactly high priority.

    I wouldn't have spotted this problem without going through everything in the response but thanks for your efforts!

    Have a good day.

    Hello

    Programs such as Norton, McAfee and others can monitor or affect the trash
    so to use the clean boot method to see if there is something in the appearance of starting the
    issue. Use the rest of the troubleshooter if necessary.

    ================================================================

    References to Vista also apply to Windows 7.

    What antivirus/antispyware/security products do you have on the machine? Be one you have NEVER
    on this machine, including those you have uninstalled (they leave leftovers behind which can cause
    strange problems).

    ----------------------------------------------------

    Follow these steps:

    Try these to erase corruption and missing/damaged file system repair or replacement.

    Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN

    Enter this at the command prompt - sfc/scannow

    How to fix the system files of Windows 7 with the System File Checker
    http://www.SevenForums.com/tutorials/1538-SFC-SCANNOW-Command-System-File-Checker.html

    How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
    generates in Windows Vista cbs.log
    http://support.Microsoft.com/kb/928228

    Also run CheckDisk, so we cannot exclude as much as possible of the corruption.

    How to run check disk in Windows 7
    http://www.SevenForums.com/tutorials/433-disk-check.html

    ==========================================

    After the foregoing:

    How to troubleshoot a problem by performing a clean boot in Windows Vista or
    Windows 7

    http://support.Microsoft.com/kb/929135

    Use advanced tools to solve performance problems in Windows 7
    http://www.howtogeek.com/HOWTO/6152/use-advanced-tools-to-troubleshoot-performance-problems-in-Windows-7/

    Problems with the overall speed of the system and performance
    http://support.Microsoft.com/default.aspx/GP/slow_windows_performance?p=1

    How to troubleshoot performance issues in Windows Vista
    http://support.Microsoft.com/kb/950685

    Optimize the performance of Microsoft Windows Vista
    http://support.Microsoft.com/kb/959062
    To see everything that is in charge of startup - wait a few minutes with nothing to do - then right-click
    Taskbar - the Task Manager process - take a look at stored by - Services - this is a quick way
    reference (if you have a small box at the bottom left - show for all users, then check that).

    How to change, add or remove startup programs in Windows 7
    http://www.SevenForums.com/tutorials/1401-startup-programs-change.html

    A quick check to see that load method 2 is - using MSCONFIG then put a list of
    those here.
    --------------------------------------------------------------------

    Tools that should help you:

    Process Explorer - free - find out which files, key of registry and other objects processes have opened.
    What DLLs they have loaded and more. This exceptionally effective utility will show you even who has
    each process.
    http://TechNet.Microsoft.com/en-us/Sysinternals/bb896653.aspx

    Autoruns - free - see what programs are configured to start automatically when you start your system
    and you log in. Autoruns also shows you the full list of registry and file locations where applications can
    Configure auto-start settings.
    http://TechNet.Microsoft.com/en-us/sysinternals/bb963902.aspx
    Process Monitor - Free - monitor the system files, registry, process, thread and DLL real-time activity.
    http://TechNet.Microsoft.com/en-us/Sysinternals/bb896645.aspx

    There are many excellent free tools from Sysinternals
    http://TechNet.Microsoft.com/en-us/Sysinternals/default.aspx

    -Free - WhatsInStartUP this utility displays the list of all applications that are loaded automatically
    When Windows starts. For each request, the following information is displayed: Type of startup (registry/Startup folder), Command - Line String, the product name, Version of the file, the name of the company;
    Location in the registry or the file system and more. It allows you to easily disable or remove unwanted
    a program that runs in your Windows startup.
    http://www.NirSoft.NET/utils/what_run_in_startup.html

    There are many excellent free tools to NirSoft
    http://www.NirSoft.NET/utils/index.html

    Window Watcher - free - do you know what is running on your computer? Maybe not. The window
    Watcher says it all, reporting of any window created by running programs, if the window
    is visible or not.
    http://www.KarenWare.com/PowerTools/ptwinwatch.asp

    Many excellent free tools and an excellent newsletter at Karenware
    http://www.KarenWare.com/

    ===========================================

    Think about it an absolute must - manually update your drivers.

    Vista and Windows 7 updated drivers love then here's how update the most important.

    This is my generic how updates of appropriate driver:

    This utility, it is easy see which versions are loaded:

    -Free - DriverView utility displays the list of all device drivers currently loaded on your system.
    For each driver in the list, additional useful information is displayed: load address of the driver,
    Description, version, product name, company that created the driver and more.
    http://www.NirSoft.NET/utils/DriverView.html

    For drivers, visit manufacturer of emergency system and of the manufacturer of the device that are the most common.
    Control Panel - device - Graphics Manager - note the brand and complete model
    your video card - double - tab of the driver - write version information. Now, click on update
    Driver (this can do nothing as MS is far behind the certification of drivers) - then right-click.
    Uninstall - REBOOT it will refresh the driver stack.

    Repeat this for network - card (NIC), Wifi network, sound, mouse, and keyboard if 3rd party
    with their own software and drivers and all other main drivers that you have.

    Now in the system manufacturer (Dell, HP, Toshiba as examples) site (in a restaurant), peripheral
    Site of the manufacturer (Realtek, Intel, Nvidia, ATI, for example) and get their latest versions. (Look for
    BIOS, Chipset and software updates on the site of the manufacturer of the system here.)

    Download - SAVE - go to where you put them - right click - RUN AD ADMIN - REBOOT after
    each installation.

    Always check in the Device Manager - drivers tab to be sure the version you actually install
    presents itself. This is because some restore drivers before the most recent is installed (sound card drivers
    in particular that) so to install a driver - reboot - check that it is installed and repeat as
    necessary.

    Repeat to the manufacturers - BTW in the DO NOT RUN THEIR SCANNER device - check
    manually by model.

    Look at the sites of the manufacturer for drivers - and the manufacturer of the device manually.
    http://pcsupport.about.com/od/driverssupport/HT/driverdlmfgr.htm

    Installation and update of drivers under Windows 7 (updated drivers manually using the methods above
    It is preferable to ensure that the latest drivers from the manufacturer of system and device manufacturers are located)
    http://www.SevenForums.com/tutorials/43216-installing-updating-drivers-7-a.html

    If you update the drivers manually, then it's a good idea to disable the facilities of driver under Windows
    Updates, that leaves about Windows updates but it will not install the drivers that will be generally
    older and cause problems. If updates offers a new driver and then HIDE it (right click on it), then
    get new manually if you wish.

    How to disable automatic driver Installation in Windows Vista - drivers
    http://www.AddictiveTips.com/Windows-Tips/how-to-disable-automatic-driver-installation-in-Windows-Vista/
    http://TechNet.Microsoft.com/en-us/library/cc730606 (WS.10) .aspx

    ===========================================

    Refer to these discussions because many more excellent advice however don't forget to check your antivirus
    programs, the main drivers and BIOS update and also solve the problems with the cleanboot method
    first.

    Problems with the overall speed of the system and performance
    http://support.Microsoft.com/GP/slow_windows_performance/en-us

    Performance and Maintenance Tips
    http://social.answers.Microsoft.com/forums/en-us/w7performance/thread/19e5d6c3-BF07-49ac-a2fa-6718c988f125

    Explorer Windows stopped working
    http://social.answers.Microsoft.com/forums/en-us/w7performance/thread/6ab02526-5071-4DCC-895F-d90202bad8b3

    I hope this helps.

  • DELETE the query takes a long time

    Hi all guru.

    My Version of DB: 10.2.0
    OS: Windows Server 2003

    I run a delete on a table of paritioned command to remove all the lines in one of the parition. The command is:

    The table name is cat_in_data_052012

    delete CAT_IN_DATA_052012 WHERE name of FILE AS: SYS_B_O


    Table conatins million record.


    Thanks in advance

    >
    I run a delete on a table of paritioned command to remove all the lines in one of the parition. The command is:

    The table name is cat_in_data_052012

    delete CAT_IN_DATA_052012 WHERE name of FILE AS: SYS_B_O
    >
    Mention the name of partition specifically in the query to ensure that only one partition is affected.

    See the example (at the end) for the deletion of rows in a Partition in the SQL reference Guide
    http://docs.Oracle.com/CD/B12037_01/server.101/b10759/statements_8005.htm#i2126857

    Deleting Rows from a Partition: Example
    
    The following example removes rows from partition sales_q1_1998 of the sh.sales table:
    
    DELETE FROM sales PARTITION (sales_q1_1998)
       WHERE amount_sold > 10000;
    
  • WANT to m6: Windows Update taking a long time

    My laptop recently had an update waiting for a 'new feature windows 10', I decided to update by clicking on update and close. Once that the screen says of things such as the update of preparation and installation of update.
    Then a black screen pops up and had a white buffering the symbol on the bottom, similar to the start, but without the hp logo screen. Since the update, my laptop has slept on this screen for about 30 hours now, with the buffering continuous symbol.
    Is this normal? Is there a possible way to speed up the process?

    Hi@Jaysonic,

    Welcome HP forums . The best place for all kinds of solutions, tips and settings for your questions/problems.

    For the best experience on HP forum, see our Guide to HP Forums to learn more.

    Stuck Windows Update. Is this fair?

    I will definitely help you.

    Try to restart the PC once and see if that starts the process of update quickly.

    Let me know to learn more.

    Resolv_S

    Happy to help you. I work for HP

    Please click "Accept as Solution" if you feel my post solved your problem, it will help others find the solution.
    Click on ' Bravo Thumbs Up ' to say 'Thank you' to help!

  • Windows 7 taking a long time to connect to the wireless network

    When I try to connect to the wireless network, it takes about a minute or two.  I didn't have this problem until I updated my card wireless about a week ago.

    Thank you very much.  I think I solved the problem.  I didn't have this problem until I updated my card with the latest wireless.  But I uninstalled the new and re-installed version, and that seemed to solve the problem.

  • The update takes a long time

    Hi we have a customer_status of the table where we have the following columns such as contacted_date and status

    Under certain conditions, it will read all lines and update the data

    as the customer_status UPDATE

    SET contacted_date = < some_date >

    When status = 0 and contacted_date is set to null

    It's taking a long time and have hanged...

    Please let me know what I need to check in what concerns the DB from Redolog setting or any other setting that I am basically a developer all

    The current version of the DB is:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

    CUSTOMER_STATUS

    CONTACTED_DATE TIMESTAMP

    STATUS NVARCHAR (1)

    Any suggestions would be much appreciated.

    I've seen this kind of problem before and there is no simple answer.  You are better off watching a redesign, otherwise, you will have to resort to brute force tactics to improve performance.  And even then the best you can do is still very limited.

    If you have a table "customer_status" with a "status" column that has probably only 2-0 and 1 values.  This means that the optimizer will believe, in the absence of all histograms for each value to roughly half of the rows in the corresponding table.  Think about it, it makes sense.  In turn, that means that the optimizer is more likely to choose a full table scan to run the UPDATE.  In turn, which means that as time passes and the table grows then the update becomes slower and slower every time that it is executed.

    Solution?  A redesign.  Really, it's the "best solution".  Otherwise you still go to the fight against the problem that the "Status" column has only 2 values in it and Oracle can assume that half of the lines end with each value.  With these statistics, the optimizer will always choose a full as table scan being the cost lowest and as the table grows so the update is slower.

    You can try to create an index on the status and contacted_date on customer_status (status, contacted_date).  But that works only if the "status" has a NOT NULL constraint on it, which does not appear in your column definitions.  Without that the index would be always useless and Oracle would still do a full table scan.

    You would also go the questions that your query uses a 0, which is a NUMBER, but the definition of the column is of type NVARCHAR and Oracle will add an implicit conversion around the column to convert number in the execution of the query, which again once stops using the index on two columns.  Data types must match for an index to use.

    You could create a histogram of frequencies located on the 'Status' column so that the optimizer has more precise statistics.  But this can depend on when in the day, the table statistics are collected.

    These tables tend to be very dynamic with data changing in their breast. How many lines in this table?  Are all deleted?  Or they stay there forever?  How many times does change the status value?  Or it fixed once and stay the same forever?

    I've seen problems of treatment of systems with a table of 'work' with a "status" column on work, and depending on what time of the day, statistics were collected from this table, it could have vastly different numbers of lines in there and a different number of lines with different values for the 'status '.  Ultimately we did an overhaul and separate tables used - one for in the expectation of work - and one for completed tasks that kept the data sets smaller and meant that the table 'pending' only pending works in.

    John

Maybe you are looking for

  • LPX will play not any sound, any way to fix?

    Logic Pro X leave while I was downloading Nexus 2.2.1 I tried reopening LPX, it gave me an error message. I opened LPX while maintaining the control key and selecting no to basic audio question. Since then, I was able to find LPX, but now, I have abs

  • Ransomware

    should I disconnect my external hard drive between backups

  • Last Firefox 15.0 freezes solid Ubuntu!

    Today updated Firefox updated to version 15.0. Immediately, it froze my system Ubuntu 11.10 solid. I have a Core 2 duo and 2Gib RAM and everything is fast. All previous versions worked flawlessly. I can reproduce the problem every time. All I have to

  • Satellite M105-S3041 - where to find the correct drivers?

    I wiped the unit and reinstalled the operating system. Now, I can't get on the Internet. How can I find the driver appropriate for my Satellite M105-S3041?

  • Helps the headphone jack!

    Welcome.So about 4-5 months ago, I bought a brand new HP Pavilion PC g6.A few months later (2-3) I started to have problems with the sound. Whenever I plugged the headphones, the sound would not come to her. First of all, I thought it was the helmet