Update Query very slow

Hi All
I have three setups on which i have to run same query which is mentioned below. The execution plan on all three setups is same for the mentioned query. Still in one of the setup the query is taking almost 8 Hrs to complete. while in rest 2 setups it takes 2 Hrs to complete. The Ram Available for the setup is Same(16 GB). I tried to increase yhe SGA size but not got the expected results. i do not have DBA support for the same. I have also analysed and changed the parameter Index_OPtimizer_cost and made sure vthat this parameter is same for all three setups.
The main problem is i can not modify the query as it is been generated during on the processes. But as mentioned earlier the query generated on all three setup is same. I also changed log_buffer_size. The query is :
UPDATE /*+ BYPASS_UJVC */ ( SELECT Main Table_name.n_exp_covered_amt_irb AS T0 , CASE WHEN COND0 = 0 THEN BP0 ELSE BP1 END AS T1 FROM Global temp table , Main Table Name WHERE Main Table Name.n_gaap_skey=Gloabl Temp table.n_gaap_skey AND Main Table Name.n_run_skey=Gloabl Temp table.n_run_skey AND Main Table Name.n_acct_skey=Gloabl Temp table.n_acct_skey AND Main Table Name.fic_mis_date=Gloabl Temp table.fic_mis_date) SET T0 = T1
Indexes are same on the All three setups also one index is present for the column name mentioned in the where clause of the query.
The oracle version used is 10.0.1.0 in first setup in second setup i am using 10.0.2.0 and in third setup it's 10.0.4.0. The query is taking time where 10.0.2.0 version is installed.
When i have looked in to the session while the query e=was executing SORT OUTPUT was taking most of the time.
Thanks in Advance. It's very critical for me to get it resolved.Any suggestions are extremely welcome.

Hi,
please check the indexes on the colums of table where sort is happening. if indexes are not there then create it or rebuilt it. also the sql tuning advisor
recommendation in dbconsole.
thanks

Similar Messages

  • My iPod touch is downloading and updating apps very slow more than an hour.

    My iPod touch 4th gen 32gb verson 4.3.1 is downloading and updating apps very slow more than an hour. I just got it a day ago and I backed up all my apps music and pictures and videos from iTunes. Few months ago I had an iPod touch but I lost it and it was working fine. Luckily before I lost it i backed up everything to iTunes so now everything that was in my old iPod is now in my new iPod. Anyways, When I first bought it I straight away backed up everything and saw that i had many updates on my apps. I started updating it all at once but even the first one was not loading at all and mty ipod was hanging many times during the updates so i cancelled all the updates. i even tried it on my computer and it was taking forever but my laptop does updating and downloading apps slower than my ipod so that doesnt matter. Even when I download an app on my iPod now its take more that an hour. So i was wondering, is my iPod slow cause I backed up too many things when i just got it . I have about 120 apps 150 plus photos and 70 videos and I backed it up all in one night on the day i got my ipod. So now I'm restoring my iPod and updating it to IOS 5 and see what happens. Hopefully it will be faster then but I still need to know what is main problem of m iPod hanging and slow updating/downloading. Need a reply ASAP. Thanks

    Still you can switch it off while syncing.
    You can also do a reset (Hold Sleep/Wake and Home buttons about 10 secs or more till Apple logo appears)

  • Query very slow!

    I have Oracle 9i and SUN OS 5.8
    I have a Java application that have a query to the Customer table. This table has 2.000.000 of records and I have to show its in pages (20 record each page)
    The user query for example the Customer that the Last Name begin with “O”. Then the application shows the first 20 records with this condition and order by Name.
    Then I have to create 2 querys
    1)
    SELECT id_customer,Name
    FROM Customers
    WHERE Name like 'O%'
    ORDER BY id_customer
    But when I proved this query in TOAD it take long to do it (the time consuming was 15 minutes)
    I have the index in the NAME field!!
    Besides, if the user want to go to the second page the query is executed again. (The java programmers said me that)
    What is your recommendation to optimize it????? I need to obtain the information in
    few seconds.
    2)
    SELECT count(*) FROM Customers WHERE NAME like 'O%'
    I have to do this query because I need to known How many pages (20 records) I need to show.
    Example with 5000 records I have to have 250 pages.
    But when I proved this query in TOAD it take long to do it (the time consuming was 30 seconds)
    What is your recommendation to optimize it????? I need to obtain the information in
    few seconds.
    Thanks in advance!

    This appears to be a dulpicate of a post in the Query very slow! forum.
    Claudio, since the same folks tend to read both forums, it is generally preferred that you post questions in only one forum. That way, multiple people don't spend time writing generally equivalent replies.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Update query is slow with merge replication

    Hello friend,
    I have a database with enabling merge replication.
    Then the problem is update query is taking more time.
    But when I disable the merge triggers then it'll update quickly.
    I really appreciate your
    quick response.
    Thanks.

    Hi Manjula,
    According to your description, the update query is slow after configuring merge replication. There are some proposals for you troubleshooting this issue as follows.
    1. Perform regular index maintenance, update statistics, re-index, on the following Replication system tables.
        •MSmerge_contents
        •MSmerge_genhistory
        •MSmerge_tombstone
        •MSmerge_current_partition_mappings
        •MSmerge_past_partition_mappings
    2. Make sure that your tables involved in the query have suitable indexes. Also do the re-indexing and update the statistics for these tables. Additionally, you can use
    Database Engine Tuning Advisor to tune databases for better query performance.
    Here are some related articles for your reference.
    http://blogs.msdn.com/b/chrissk/archive/2010/02/01/sql-server-merge-replication-best-practices.aspx
    http://technet.microsoft.com/en-us/library/ms177500(v=sql.105).aspx
    Thanks,
    Lydia Zhang

  • Newest security update is very slow to install

    Newest security software update is very slow to install  for MacBook Pro

    No man wait for it to complete....sometimes due to some reason it may take time if u shutdown in between download process then it is fine u can download again but if u shut down in betw the installing process then u may loose ur data and crash the system....better wait
    do reply cheers TGT

  • Oracle 11G - Update is very slow on View

    I have big trouble with some Update query on Oracle 11G.
    I have a set of tables (5) of identical structures and a view that consists in an UNION ALL of the 5 tables.
    None of this table contains more than 20 000 rows.
    Let's call the view V_INTE_NE. Each of the basic table has a PRIMARY KEY defined on 3 NUMBERS(10,0) -> INTE_REF / NE_REF / INSTANCE.
    Now, I get 6 rows in another table and I want to update my view from the data of this small table (let's call it SMALL). This table has the 3 columns INTE_REF / NE_REF / INSTANCE.
    When I try to join the two tables :
    SELECT * FROM T_INTE_NE T2
    WHERE EXISTS ( SELECT 1 FROM SMALL T1 WHERE T2.INTE_REF = T1.INTEREF AND T2.NE_REF = T1.NEREF AND T2.INTE_INST = T1.INSTANCE )
    I get the 6 lines in 0.037 seconds
    When I try to update the view (I have an INSTEAD OF trigger that does nothing (just return for testing even without modifying anything), I execute the following query :
    UPDATE T_INTE_NE T2
    SET INTE_STATE = -11 WHERE
    EXISTS ( SELECT 1 FROM SMALL T1 WHERE T2.INTE_REF = T1.INTEREF AND T2.NE_REF = T1.NEREF AND T2.INTE_INST = T1.INSTANCE )
    The 6 rows are updated (at least TRIGGER is called) in 20 seconds.
    However, in the execution plan, I can't see where Oracle takes time to achieve the query :
    Plan hash value: 907176690
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | UPDATE STATEMENT | | 6 | 36870 | 153 (1)| 00:00:02 |
    | 1 | UPDATE | T_INTE_NE | | | | |
    |* 2 | HASH JOIN RIGHT SEMI | | 6 | 36870 | 153 (1)| 00:00:02 |
    | 3 | TABLE ACCESS FULL | SMALL | 6 | 234 | 9 (0)| 00:00:01 |
    | 4 | VIEW | T_INTE_NE | 6 | 36636 | 143 (0)| 00:00:02 |
    | 5 | VIEW | X_V_T_INTE_NE | 6 | 18636 | 143 (0)| 00:00:02 |
    | 6 | UNION-ALL | | | | | |
    | 7 | TABLE ACCESS FULL| SECNODE1_T_INTE_NE | 1 | 3106 | 60 (0)| 00:00:01 |
    | 8 | TABLE ACCESS FULL| SECNODE2_T_INTE_NE | 1 | 3106 | 60 (0)| 00:00:01 |
    | 9 | TABLE ACCESS FULL| SECNODE3_T_INTE_NE | 1 | 3106 | 2 (0)| 00:00:01 |
    | 10 | TABLE ACCESS FULL| SECNODE4_T_INTE_NE | 1 | 3106 | 2 (0)| 00:00:01 |
    | 11 | TABLE ACCESS FULL| SECNODE5_T_INTE_NE | 1 | 3106 | 2 (0)| 00:00:01 |
    | 12 | TABLE ACCESS FULL| SYS_T_INTE_NE | 1 | 3106 | 17 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("T2"."INTE_REF"="T1"."INTEREF" AND "T2"."NE_REF"="T1"."NEREF" AND
    "T2"."INTE_INST"="T1"."INSTANCE")
    Note
    - dynamic sampling used for this statement (level=2)
    Statistics
    3 user calls
    0 physical read total bytes
    0 physical write total bytes
    0 spare statistic 3
    0 commit cleanout failures: cannot pin
    0 TBS Extension: bytes extended
    0 total number of times SMON posted
    0 SMON posted for undo segment recovery
    0 SMON posted for dropping temp segment
    0 segment prealloc tasks
    What could explain the difference ?
    I get exactly the same execution plan (when autotrace is ON).
    Furthermore, if I try to do the same update on each of the basic tables, I get the rows updated instantaneously.
    Is there any reason for avoiding this kind of query ?
    Any help would be greatly appreciated :-)
    Regards,
    Patrick

    Sorry for this, I lost myself in conjonctures and I didn't think I would have to explain the whole case.
    So, I wrote a small piece of PL/SQL that reproduces the same issue.
    It seems that my issue is not due to the UPDATE but to the use of the IN predicate.
    As you can see at the end of the script, I try to join the 2 tables using different technics.
    The first query is very fast, the second is very slow.
    I need the second one if I want to do any update.
    DROP TABLE Part1;
    DROP TABLE Part2;
    DROP TABLE Part3;
    DROP TABLE Part4;
    CREATE TABLE Part1 ( Key1 NUMBER(10, 0), Key2 NUMBER(10, 0), Key3 NUMBER(10, 0), PartId NUMBER(10, 0) DEFAULT( 1 ) NOT NULL, Data1 VARCHAR2(1000), X_Data2 VARCHAR2(2000) NULL, X_Data3 VARCHAR2(2000) NULL, CONSTRAINT PK_Part1 PRIMARY KEY( Key1, Key2, Key3 ) );
    CREATE TABLE Part2 ( Key1 NUMBER(10, 0), Key2 NUMBER(10, 0), Key3 NUMBER(10, 0), PartId NUMBER(10, 0) DEFAULT( 2 ) NOT NULL, Data1 VARCHAR2(1000), X_Data2 VARCHAR2(2000) NULL, X_Data3 VARCHAR2(2000) NULL, CONSTRAINT PK_Part2 PRIMARY KEY( Key1, Key2, Key3 ) );
    CREATE TABLE Part3 ( Key1 NUMBER(10, 0), Key2 NUMBER(10, 0), Key3 NUMBER(10, 0), PartId NUMBER(10, 0) DEFAULT( 3 ) NOT NULL, Data1 VARCHAR2(1000), X_Data2 VARCHAR2(2000) NULL, X_Data3 VARCHAR2(2000) NULL, CONSTRAINT PK_Part3 PRIMARY KEY( Key1, Key2, Key3 ) );
    CREATE TABLE Part4 ( Key1 NUMBER(10, 0), Key2 NUMBER(10, 0), Key3 NUMBER(10, 0), PartId NUMBER(10, 0) DEFAULT( 4 ) NOT NULL, Data1 VARCHAR2(1000), X_Data2 VARCHAR2(2000) NULL, X_Data3 VARCHAR2(2000) NULL, CONSTRAINT PK_Part4 PRIMARY KEY( Key1, Key2, Key3 ) );
    CREATE OR REPLACE FUNCTION Decrypt
    x_in IN VARCHAR2
    ) RETURN VARCHAR2
    AS
    x_out VARCHAR2(2000);
    BEGIN
    SELECT REVERSE( x_in ) INTO x_out FROM DUAL;
    RETURN ( x_out );
    END;
    CREATE OR REPLACE VIEW AllParts AS
    SELECT Key1, Key2, Key3, PartId, Data1, Decrypt( X_Data2 ) AS Data2, Decrypt( X_Data3 ) AS Data3 FROM Part1
    UNION ALL
    SELECT Key1, Key2, Key3, PartId, Data1, Decrypt( X_Data2 ) AS Data2, Decrypt( X_Data3 ) AS Data3 FROM Part2
    UNION ALL
    SELECT Key1, Key2, Key3, PartId, Data1, Decrypt( X_Data2 ) AS Data2, Decrypt( X_Data3 ) AS Data3 FROM Part3
    UNION ALL
    SELECT Key1, Key2, Key3, PartId, Data1, Decrypt( X_Data2 ) AS Data2, Decrypt( X_Data3 ) AS Data3 FROM Part4;
    DROP TABLE Small;
    CREATE TABLE Small ( Key1 NUMBER(10, 0), Key2 NUMBER(10, 0), Key3 NUMBER(10, 0), Data1 VARCHAR2(1000) );
    BEGIN
    DECLARE
    n_Key NUMBER(10, 0 ) := 0;
    BEGIN
    WHILE ( n_Key < 50000 )
    LOOP
    INSERT INTO Part1( Key1, Key2, Key3 )
    VALUES( n_Key, FLOOR( n_Key / 10 ), FLOOR( n_Key / 100 ) );
    INSERT INTO Part2( Key1, Key2, Key3 )
    VALUES( n_Key, FLOOR( n_Key / 10 ), FLOOR( n_Key / 100 ) );
    INSERT INTO Part3( Key1, Key2, Key3 )
    VALUES( n_Key, FLOOR( n_Key / 10 ), FLOOR( n_Key / 100 ) );
    INSERT INTO Part4( Key1, Key2, Key3 )
    VALUES( n_Key, FLOOR( n_Key / 10 ), FLOOR( n_Key / 100 ) );
    n_Key := n_Key + 1;
    END LOOP;
    INSERT INTO Small( Key1, Key2, Key3, Data1 ) VALUES ( 1000, 100, 10, 'Test 1000' );
    INSERT INTO Small( Key1, Key2, Key3, Data1 ) VALUES ( 3000, 300, 30, 'Test 3000' );
    INSERT INTO Small( Key1, Key2, Key3, Data1 ) VALUES ( 5000, 500, 50, 'Test 5000' );
    COMMIT;
    END;
    END;
    SELECT T2.*
    FROM Small T1, AllParts T2
    WHERE T2.Key1 = T1.Key1 AND T2.Key2 = T1.Key2 AND T2.Key3 = T1.Key3;
    SELECT T1.*
    FROM AllParts T1
    WHERE ( T1.Key1, T1.Key2, T1.Key3 ) IN ( SELECT T2.Key1, T2.Key2, T2.Key3 FROM Small T2 );

  • Update Process Very Slow in Oracle 8 which update bulk data

    Dear all
    i am just updating data through SQLsub-query,but i want to get to column from sub-query and need to update my source table, but there is problem is that through sub-query just return a single column while updating,but i don't wan't to re-type another query for another column due to performance issue.
    Also the other issued related performance is very slow,how should i fast update in bulk.
    Please suggest,
    Thanks

    Actually i am update time roster table with machine date, first i get from file & insert into Machine_table & then
    i make joing query & then update roster table which is like below.
    in roster table data consist 1 to last day of month of every employee.
    update roster a
    set (a.timein,a.timeout) = (select timein,timeout from machine_table mch
    where a.roster_date = mch.roster_date and a.person_id = mch.person_id);
    this query is updating around 7750 & it takes to much time.
    please help urgent thanks.

  • Wsus 6.3 - Server 2012 R2 - Update downloads very slow - no proxy is use

    I have WSUS 6.3.9600.16384 installed on Server 2012 R2 and downloads are very slow, < 500 Kbps.
    A proxy server is not in use and updates are downloading, but very slowly.
    Plenty of BW available, consistent 60 Mbps internet download speed test results.
    Current download setting is set to "on approval".
    Has anyone had a similar problem and hopefully found a solution?

    Am 03.04.2015 schrieb Joel-L:
    Download operation is successful so I do not believe there is a problem with HTTP 1.1. range requests through my firewall.  I would have tried KB anyway but none of the "*SQL.EXE" programs are on my 2012 R2 system so I was unable to try it.
    Resolution 1 i wrote.
    http://support.microsoft.com/en-us/kb/922330 You can install a SQL Server Management Studio, connect to your WID and can run this Query:
    UPDATE [SUSDB].[dbo].[tbConfigurationC] SET BitsDownloadPriorityForeground=1
    Servus
    Winfried
    Gruppenrichtlinien
    HowTos zum WSUS Package Publisher
    WSUS Package Publisher
    HowTos zum Local Update Publisher
    NNTP-Bridge für MS-Foren

  • After 10.5.2 update, computer very slow

    Downloaded/installed update without incident. Microsoft Office programs are now very slow to open and very slow to perform certain tasks, like trashing an email. Emptying trash in the Finder sometimes works/sometimes doesn't. When it doesn't, I get a dialog box saying "You can't open Trash because Trash is being emptyed" or words to that effect. Force quitting hung aps usually does not work. It is sometimes possible to shut down or restart using the commands in the Apple menu but I've had to just power cycle the computer twice today when the commands didn't work. I tried verifying permissions but even that seemed to hang. Verifying the disk worked and it says the disk is ok. Any ideas on how to solve this? It almost feels like I've run out of memory but Activity Monitor says otherwise. Stumped.

    I had some of the exact same issues. After I installed the 10.5.2 update and noticed these issues, I ran Software Update again and found a "Leopard Graphics Update 1.0".
    http://www.apple.com/support/downloads/leopardgraphicsupdate10.html
    Once I installed this graphics update, my computer was back to normal.

  • SPATIAL QUERY VERY SLOW

    I CAN TO EXECUTE THIS QUERY BUT IT IS VERY SLOW, I HAVE 2 TABLE , ONE A WITH 250.000 SITE AND B WITH 250.000 POINTS, I WANT TO DETERMINING HOW MANY RISK INSIDE THE SITES.
    THANKS
    JGS
    SELECT B.ID, A.ID, A.GC, A.SUMA
    FROM DBG_RIESGOS_CUMULOS_SITE A, DBG_RIESGOS_CUMULOS B
    WHERE A.GC = 'PATRIMONIAL FENOMENOS SISMICOS' AND A.GC=B.GC
    AND SDO_RELATE(B.GEOMETRY, A.GEOMETRY, 'MASK=INSIDE') = 'TRUE';
    100 RECORS IN 220 '' SLOWWWWW

    I would do two things:
    1) Ensure Oracle is patched with the latest 10.2.0.4 patches
    This is the list I've been working with:
    Patch 7003151
    Patch 6989483
    Patch 7237687
    Patch 7276032
    Patch 7307918
    2) Write the query like this
    SELECT /*+ ORDERED*/ B.ID, A.ID, A.GC, A.SUMA
    FROM DBG_RIESGOS_CUMULOS B, DBG_RIESGOS_CUMULOS_SITE A
    WHERE B.GC = 'PATRIMONIAL FENOMENOS SISMICOS'
    AND A.GC=B.GC
    AND SDO_ANYINTERACT(A.GEOMETRY, B.GEOMETRY) = 'TRUE';

  • Oracle interview questions;; query very slow

    Hai
    Most of time in interview they ask..
    WHAT IS THE STEPS U DO WHEN UR QUERY IS RUNNNING VERY SLOW..?
    i used to say
    1) first i will check for whether table is properly indexed or not
    2) next properly normalized or not
    interviewers are not fully satisfied with these answers..
    So kindly tell me more suggestion
    S

    Also when checking the execution plan, get the actual plan using DBMS_XPLAN.DISPLAY_CURSOR, rather than the predicted one (EXPLAIN PLAN FOR). If you use a configurable IDE such as SQL Developer of PL/SQL Developer it is worth taking the time to set this up in the session browser so that you can easily capture it while it's running. You might also look at the estimated vs actual cardinalities. While you're at it you could check v$session_longops, v$session_wait and (if you have the Diagnostic and Tuning packs licenced) v$active_session_history and the various dba_hist% views.
    You might try the SQL Tuning Advisor (DBMS_SQLTUNE) which generates profiles for SQL statements (requires ADVISOR system privilege to run a tuning task, and CREATE ANY SQL PROFILE to apply a profile).
    In 11g look at SQL Monitor.
    Tracing is all very well if you can get access to the tracefile in a reasonable timeframe, though in many sites (including my current one) it's just too much trouble unless you're a DBA.
    Edited by: William Robertson on Apr 18, 2011 11:40 PM
    Sorry Rob, should probably have replied to oraclehema rather than you.

  • User Defined Type - Array bind Query very slow

    Hi.
    I have following Problem. I try to use Oracle Instant Client 11 and ODP.NET to pass Arrays in SELECT statements as Bind Parameters. I did it, but it runs very-very slow. Example:
    - Inittial Query:
    SELECT tbl1.field1, tbl1.field2, tbl2.field1, tbl2.field2 ... FROM tbl1
    LEFT JOIN tbl2 ON tbl1.field11=tbl2.field0
    LEFT JOIN tbl3 ON tbl2.field11=tbl3.field0 AND tbll1.field5=tbl3.field1
    ...and another LEFT JOINS
    WHERE
    tbl1.field0 IN ('id01', 'id02', 'id03'...)
    this query with 100 elements in "IN" on my database takes 3 seconds.
    - Query with Array bind:
    in Oracle I did UDT: create or replace type myschema.mytype as table of varchar2(1000)
    than, as described in Oracle Example I did few classes (Factory and implementing IOracleCustomType) and use it in Query,
    instead of IN ('id01', 'id02', 'id03'...) I have tbl1.field0 IN (select column_value from table(:prmTable)), and :prmTable is bound array.
    this query takes 190 seconds!!! Why? I works, but the HDD of Oracle server works very hard, and it takes too long.
    Oracle server we habe 10g.
    PS: I tried to use only 5 elements in array - the same result, it takes also 190 seconds...
    Please help!

    I recommend you generate an explain plan for each query and post them here. Based on what you have given the following MAY be happening:
    Your first query has as static IN list when it is submitted to the server. Therefore when Oracle generates the execution plan the CBO can accurately determine it based on a KNOWN set of input parameters. However the second query has a bind variable for this list of parameters and Oracle has no way of knowing at the time the execution plan is generated what that list contains. If it does not know what the list contains it cannot generate the most optimal execution plan. Therefore I would guess that it is probably doing some sort of full table scan (although these aren't always bad, remember that!).
    Again please post the execution plans for each.
    HTH!

  • 10g Form - first execute query - very slow

    I have the following issue:
    Enter an application
    open a form in enter query mode
    first time execute query is very slow (several minutes)
    every other time it's quick (couple seconds or less)
    I can leave the form, use other forms within the app, come back and query is still quick. It's only the first time after initially launching the app.
    Any ideas what might be causing this?

    We have the same application running in 6i client/server DB-9i in production. We are testing the upgraded application that is 10g forms on OAS DB-10g. We don't have the issue in the current production client/server app.

  • UPdation is very slow

    Updation in a one table of our database is very slow. How i identify which thing is causing problem.
    Any idea ????
    Thanks

    The tkprof shows that the main problem is due to too much parsing and is two-fold:
    1) you are parsing every statement again and again. They are 1019 soft parses and 932 hard parses. By using bind variables you make sure you are not hard parsing every time, under normal circumstances. In your case however you have a second problem:
    2) the cursor gets invalidated almost half of the times, and a new hard parse had to take place 932 times.
    For the first problem you have to look at the application that is executing the SQL. The application is doing:
    parse
    bind
    execute
    close
    parse
    bind
    execute
    close
    instead of
    parse
    ->bind
    ->execute
    ->bind
    ->execute
    close.
    It may be because of dynamic SQL inside PL/SQL or maybe the parameter session_cached_cursors is set to 0? Or a java application that parses too much?
    The cause of the second problem is hard to tell. What are you doing that makes the cursors go invalid each time? There are numerous ways why this may happen. Maybe you are dynamically granting privileges on the fly? Or are you flushing the shared_pool? At least something non regular is happening here and you have to find out why.
    Note that another problem is the row by row processing, but that will be an issue once the bigger one has been solved
    Regards,
    Rob.

  • UNION making query very slow... solution?

    Hi Guys,
    I want to get the records of two tables in one view. Option available in oracle is UNION.
    I have used UNION between two select statement. There are above 15,000 records in one table and around 200 in the other one.
    But after using this UNION between the select statements my view have become very slow.
    Can i use a order by command in the following view, I have tried but it gives error. What is the alternate of a UNION.
    Please help. All of our reports depend on this view and its very slow.
    the script of the view is as follows:
    CREATE OR REPLACE VIEW "COMMON"."V_SEL_SYS_EMP" AS
    Select Employee.Emp_Employees.Employee_ID,
    trim(Employee.Emp_Employees.Emp_F_Name) ||' '|| trimemployee.Emp_Employees.Emp_L_Name) As
    Emp_Name, Employee.Emp_Employees.Branch_ID,
    Common.Com_Branches.Br_Name, COMMON.COM_BRANCHES.REGION_ID,
    COMMON.COM_REGIONS.REGION_NAME, COMMON.COM_BRANCHES.CHAPTER_ID,
    COMMON.COM_CHAPTERS.CHAPTER_NAME, Employee.Emp_Employees.Company_ID,
    Common.Com_Companies.Comp_Name, Employee.Emp_Employees.Department_ID,
    Common.Com_Departments.Dept_Name, Employee.Emp_Employees.Religion_ID,
    Common.Com_Religions.Religion_Name, Employee.Emp_Employees.Premises_ID,
    Common.Com_Premises.Premises_name, Employee.Emp_Employees.Categ_ID,
    Employee.Emp_Categories.Categ_Name, Employee.Emp_Employees.Desig_ID,
    Employee.Emp_Employees.Desig_Suffix, Employee.Emp_Designations.Designation,
    EMPLOYEE.EMP_EMPLOYEES.PAY_SCALE, EMPLOYEE.EMP_EMPLOYEES.BASIC_SAL,
    Employee.Emp_Employees.HEAD_OF_DEPT, Employee.Emp_Employees.Birth_Date,
    Employee.Emp_Employees.Emp_Gender, Employee.Emp_Employees.Emp_Status,
    Employee.Emp_Employees.Hire_Date, Employee.Emp_Employees.Conf_Date,
    Employee.Emp_Employees.Left_Date, Employee.Emp_Employees.Emp_Photo,
    Employee.Emp_Emp_Info.E_Mail,Employee.Emp_Employees.Dept_Head_Id FROM Employee.Emp_Employees, Common.Com_Branches,
    Common.Com_Companies, Common.Com_Departments, Common.Com_Religions, Common.Com_Premises,
    Employee.Emp_categories,
    Employee.Emp_Designations, Employee.Emp_Emp_Info, COMMON.COM_REGIONS,common.com_chapters
    Where (Employee.Emp_Employees.Branch_ID = Common.Com_Branches.Branch_ID(+))
    and (Employee.Emp_Employees.Company_ID = Common.Com_Companies.Company_ID(+))
    AND (COM_BRANCHES.REGION_ID = COM_REGIONS.REGION_ID(+))
    AND (COM_BRANCHES.CHAPTER_ID = COM_CHAPTERS.CHAPTER_ID(+))
    and (Employee.Emp_Employees.Department_ID = Common.Com_Departments.Department_ID(+))
    and (Employee.Emp_Employees.Religion_ID = Common.Com_Religions.Religion_ID(+))
    and (Employee.Emp_Employees.Premises_ID = Common.Com_Premises.Premises_ID(+))
    and (Employee.Emp_Employees.Categ_ID = Employee.Emp_Categories.Categ_ID(+))
    and (Employee.Emp_Employees.Desig_ID = Employee.Emp_Designations.Desig_ID(+))
    and (Employee.Emp_Employees.Employee_ID = Employee.Emp_Emp_Info.Employee_ID(+))
    UNION
    Select Common.Com_Non_Employees.Non_Employee_ID,
    trim(Common.Com_Non_Employees.First_Name) ||' '|| trim(Common.Com_Non_Employees.Last_Name)
    As Emp_Name, Common.Com_Non_Employees.Branch_ID,
    Common.Com_Branches.Br_Name, COMMON.COM_BRANCHES.REGION_ID,
    COMMON.COM_REGIONS.REGION_NAME, COMMON.COM_BRANCHES.CHAPTER_ID,
    COMMON.COM_CHAPTERS.CHAPTER_NAME, Common.Com_Non_Employees.Company_ID,
    Common.Com_Companies.Comp_Name, Common.Com_Non_Employees.Department_ID,
    Common.Com_Departments.Dept_Name, Common.Com_Non_Employees.Religion_ID,
    Common.Com_Religions.Religion_Name, NULL as Premises_ID,
    NULL as Premises_name, NULL as Categ_ID, NULL as Categ_Name,
    Common.Com_Non_Employees.Desig_ID, Common.Com_Non_Employees.Desig_Suffix,
    Employee.Emp_Designations.Designation, NULL as PAY_SCALE,
    NULL as BASIC_SAL, NULL as HEAD_OF_DEPT, NULL as Birth_Date,
    Common.Com_Non_Employees.Emp_Gender, NULL as Emp_Status,
    NULL as Hire_Date,NULL as Conf_Date,NULL as Left_Date,NULL as Emp_Photo,
    Employee.Emp_Emp_Info.E_Mail,Null as Dept_Head_ID
    FROM Common.Com_Non_Employees, Common.Com_Branches,
    Common.Com_Companies,
    Common.Com_Departments, Common.Com_Religions, Common.Com_Premises,
    Employee.Emp_categories, Employee.Emp_Designations, Employee.Emp_Emp_Info, COMMON.COM_REGIONS,
    common.com_chapters
    Where (Common.Com_Non_Employees.Branch_ID = Common.Com_Branches.Branch_ID(+))
    and (Common.Com_Non_Employees.Company_ID = Common.Com_Companies.Company_ID(+))
    AND (COM_BRANCHES.REGION_ID = COM_REGIONS.REGION_ID(+))
    AND (COM_BRANCHES.CHAPTER_ID = COM_CHAPTERS.CHAPTER_ID(+))
    and (Common.Com_Non_Employees.Department_ID = Common.Com_Departments.Department_ID(+))
    and (Common.Com_Non_Employees.Religion_ID = Common.Com_Religions.Religion_ID(+))
    and (Common.Com_Non_Employees.Desig_ID = Employee.Emp_Designations.Desig_ID(+))
    and (Common.Com_Non_Employees.NOn_Employee_ID = Employee.Emp_Emp_Info.Employee_ID(+))
    without UNION the two selet commands retrieve data in a quick manner.
    Plis help!
    Imran Baig

    use UNION ALL instead of UNION.
    If you still feel slow then generate the trace and see what is the bottle neck.
    alter session set events '10046 trace name context forever, level 8'
    select * from veww;
    alter session set events '10046 trace name context off';
    use tkprof to format the trace file generated by the event, you can find trace in your udump directory. And see what are the waiting events.
    Jaffar
    OCP DBA

Maybe you are looking for