Query performs well in dev but hanging on prod

Hi DBAs,
Urgent help is required on this issue.
One of my sql query performed well in dev server, but now for 1 week it is hanging in prod server so,
* How can i proceed to troubleshoot the problem.
* What are areas i need to look for , and for what ?
Regards
Asif

There could be plenty of reasons to lead this behaviour to occur, sicnce you diden't come up with valid inputs, one really can not offer a pin point advise.
in that case, I would simply recommened you to post the output of explain
plan after making sure your stats are up to date.
hare krishna
Alok

Similar Messages

  • Query performed well in dev but hanging on prod

    Hi DBAs,
    Urgent help is required on this issue.
    One of my sql query performed well in dev server, but now for 1 week it is hanging in prod server so,
    * How can i proceed to troubleshoot the problem.
    * What are areas i need to look for , and for what ?
    Regards
    Asif

    Are they both the same version of databases?
    How recent is your dev data (if possible update your dev from prod)?
    If prod to dev copy is not possible
    ....AND stats for both db are up-to-date
    ....AND big differnce in db size for dev & prod
    ....=> You can copy prod's stats and import to dev then run your query on dev to localise the issue then you can start tuning the query on dev.

  • Select query not working in Dev but working in QA and PRD

    Hi All,
    I have a select query with inner join which is not working in the DEV but working in QA and PRD. Anyone has any idea why is it happening, I think it to be a basis issue. Just want to confirm if anyone has any other idea.
    Thanks in advance,
    Barjinder Singh.

    Hi Barjinder Singh,
    In development you can't find the records for the table.
    In testing system only you can test even the program(report).
    If it is the DEV system you can't get the data.
    Go and see into the table wether it has records or not(in DEV system).
    It doesn't has the records in DEV system.
    Regards,
    Balakrishna.N

  • Case insensitive search working in dev but not in prod

    Hello All,
    I had set the CASE_SENSITIVE_CHARACTER_COMPARISON parameter as OFF in NQSConfig.ini file for enabling the case insensitive search in OBIEE.
    This setup is letting me do the case insensitive search in Dev env but the same doesnt work in prod env. I tried pointing both prod and dev rpd to same prod db.
    With same db also, case insensitive search doesnt work in prod env.
    Any idea for which other configuration I can look for.
    Thanks in advance.

    Thanks Stijin. I had seen this post earlier. Case insensitive search works fine after setting the value for NLS_SORT and NLS_COMP in production RPD but the other report with distinct clause starts failing. Not sure about the reason.
    Saw this comment from you in that post:
    The only compromise solution we could find was to "cache" the column value we wanted to use in insensitive searches. These were mainly used in "show all choices" while setting prompts. Other than that there isn't much you can do in an Oracle database.
    Can you please tell me how to implement the above.

  • Sql query to identify transports in dev but not in prod

    I use sqlplus to select fields from saperp.e070v so I can compare transports in prod with those in qa. The purpose is to identify those transports that I need to run when I H-copy prod to QA. I'm using this where clause (TRFUNCTION='K' OR TRFUNCTION='W') . Should I look at TRSTATUS? I'd appreciate any recommendations or ideas. I do not have access to ABAP.

    Thanks Markus.
    Here are the distinct codes I found. Are there any ot these That I need to be concerned about? Is there a Key/Legend for these?
    SQL> select distinct trstatus from saperp.e070v;
    T
    R
    D
    O
    SQL> select distinct trfunction from saperp.e070v;
    T
    W
    R
    P
    K
    D
    Q
    M
    T
    X
    F
    S
    T
    G
    12 rows selected.
    SQL> describe saperp.e070v;
    Name                                      Null?    Type
    TRKORR                                    NOT NULL VARCHAR2(20)
    TRFUNCTION                                NOT NULL VARCHAR2(1)
    TRSTATUS                                  NOT NULL VARCHAR2(1)
    TARSYSTEM                                 NOT NULL VARCHAR2(10)
    AS4USER                                   NOT NULL VARCHAR2(12)
    AS4DATE                                   NOT NULL VARCHAR2(8)
    AS4TIME                                   NOT NULL VARCHAR2(6)
    STRKORR                                   NOT NULL VARCHAR2(20)
    LANGU                                     NOT NULL VARCHAR2(1)
    AS4TEXT                                   NOT NULL VARCHAR2(60)
    CLIENT                                    NOT NULL VARCHAR2(3)
    SQL>
    F
    S
    T
    G
    12 rows selected.
    SQL> describe saperp.e070v;
    Name                                      Null?    Type
    TRKORR                                    NOT NULL VARCHAR2(20)
    TRFUNCTION                                NOT NULL VARCHAR2(1)
    TRSTATUS                                  NOT NULL VARCHAR2(1)
    TARSYSTEM                                 NOT NULL VARCHAR2(10)
    AS4USER                                   NOT NULL VARCHAR2(12)
    AS4DATE                                   NOT NULL VARCHAR2(8)
    AS4TIME                                   NOT NULL VARCHAR2(6)
    STRKORR                                   NOT NULL VARCHAR2(20)
    LANGU                                     NOT NULL VARCHAR2(1)
    AS4TEXT                                   NOT NULL VARCHAR2(60)
    CLIENT                                    NOT NULL VARCHAR2(3)
    SQL>

  • Query Performance issue in Oracle Forms

    Hi All,
    I am using oracle 9i DB and forms 6i.
    In query form ,qry took long time to load the data into form.
    There are two tables used here.
    1 table(A) contains 5 crore records another table(B) has 2 crore records.
    The recods fetching range 1-500 records.
    Table (A) has no index on main columns,after created the index on main columns in table A ,the query is fetched the data quickly.
    But DBA team dont want to create index on table A.Because of table space problem.
    If create the index on main table (A) ,then performance overhead in production.
    Concurrent user capacity is 1500.
    Is there any alternative methods to handle this problem.
    Regards,
    RS

    1) What is a crore? Wikipedia seems to indicate that it's either 10,000,000 or 500,000
    http://en.wikipedia.org/wiki/Crore
    I'll assume that we're talking about tables with 50 million and 20 million rows, respectively.
    2) Large tables with no indexes are definitely going to be slow. If you don't have the disk space to create an appropriate index, surely the right answer is to throw a bit of disk into the system.
    3) I don't understand the comment "If create the index on main table (A) ,then performance overhead in production." That seems to contradict the comment you made earlier that the query performs well when you add the index. Are you talking about some other performance overhead?
    Justin

  • I have Airport Extreme as the base unit and an Express unit in a room separated by a brick wall to improve signal. Express shows a green light indicating signal but my iPad does not perform well. How can I improve other than hardwire ethernet connection?

    I have Airport Extreme as the base unit and an Express unit in a room separated by a brick wall to improve signal. Express shows a green light indicating signal but my iPad does not perform well. How can I improve other than hardwire ethernet connection?

    Other suggestions, and more info about the nature of the problem, may be in this Apple tech note.
    http://support.apple.com/kb/HT1365
    For example, you might find that the brick wall is not the only problem. There may be other devices pumping out enough wireless interference to be making things even worse.
    I agree with Bob Timmons that Ethernet is best and most reliable. And that powerline (which I use) is easier and potentially faster than wireless...but only if your power lines do not have electrical devices plugged in which produce electrical noise on the line. Powerline will be slower than Gigabit Ethernet.
    Ethernet cable is the only way to ensure that the signal goes directly there in a shielded way for a clear fast signal. Wireless and powerline are much slower because of all the other things the signal has to fight past to get to the other device.

  • Query performance in two environments

    Hi all,
    I have developed simple select queries on a multiprovider and I am facing issues with query performance in quality box. A query runs pretty fast in in dev and return results while the same one dumps in Quality environment giving a time out error. This sounds more strange because our dev box has comparitively more records than the quality environment right now.
    On anlyzing the query path in both environments, we noticed that the query does an index scan in dev but not in Quality environment, especially when the selection is such that the query is supposed to return lot of records. Since the query does a sequential scan in quality, it dumps. Is there any setting that I need to make seprately in the quality environment.
    Any tips on query optimization would be great help. Thanks
    Regards
    Niranjana

    Execute some of the RSRT tests in the QA for the query using "Execute+Debug" option and use some test for Multiprovider and Databases checks in it ,try to compare with Dev as well.
    Hope it Helps
    Chetan
    @CP..

  • Problems with Full loads/Decreased query performance in Prod

    We have a table which serves as a base for a complex view. The table has roughly around 10 Million records and its a daily full load(I know, that delta loads are much better for handling large sets of data, but this information is very dynamic and with the business time constraints and project deliverables, the best decision was to do a Full load).
    This is the process we follow:
    > Drop Indexes (All columns individual indexes which are used inside the complex view as joins)
    > Truncate table
    > Load data
    > Recreate indexes.
    All the above steps are performed from SAP Dataservices Thru scripts and sql() function to execute the command, no manual intervention what so ever.
    After the job is successfully completed, the view doesn't refresh at all(It sits there forever). The same job when run across same volume of production data in Test environment performs much faster.
    Then, how do I refresh the view is manually log into SQL Developer, drop all the indexes on the parent table, and re-create all the indexes in the same order as Dataservices script. It performs very well after till the next load (the next morning).
    Any suggestions would be very helpful.
    My main question is why does it run faster, when I drop and recreate the indexes? and doesnt complete when the indexes are created by the SQL() from data services tool.
    Tried:
    Explain Plan(in dev, Test, Prod): Query cost vaired accross environments but returned results with same return times (In Production after manual Index creation)
    Tuning advisor (Only in Test) DBA evaluated it to be good.
    Thanks
    Nash
    DB Version Oracle 11.0.7
    Dataservices 3.2

    BluShadow and Harman
    Thank You!
    Im using a regular view, not a materialized view. and yes the query plan is completely different from Test and Production. In test the query was completely running on Hash based joins whereas in Production its using Nested Joins in the execution plan.
    Will try to gather statistics after the load and as per BluShadow, will look on the way of writing a function that makes a call to Database.
    Thank you all for taking sometime. I will try to test this out starting today and will extend tests over a couple of days.
    Regards
    Nash

  • Reg: Process Chain, query performance tuning steps

    Hi All,
    I come across a question like,  There is a process chain of 20 processes.out of which 5 processes are completed at the 6th step error occured and it cannot be rectified. I should start the chain again from the 7th step.If i go to a prticular step i can do that particular step, How can i start the entair chain again from step 7.i know that i need to use a function module but i dont know the name of FM. Please somebody help me out.
    Please let me know the steps involved in query performance tuning and aggregate tuning.
    Thanks & Regards
    Omkar.K

    Hi,
    Process Chain
    Method 1 (when it fails in a step/request)
    /people/siegfried.szameitat/blog/2006/02/26/restarting-processchains
    How is it possible to restart a process chain at a failed step/request?
    Sometimes, it doesn't help to just set a request to green status in order to run the process chain from that step on to the end.
    You need to set the failed request/step to green in the database as well as you need to raise the event that will force the process chain to run to the end from the next request/step on.
    Therefore you need to open the messages of a failed step by right clicking on it and selecting 'display messages'.
    In the opened popup click on the tab 'Chain'.
    In a parallel session goto transaction se16 for table rspcprocesslog and display the entries with the following selections:
    1. copy the variant from the popup to the variante of table rspcprocesslog
    2. copy the instance from the popup to the instance of table rspcprocesslog
    3. copy the start date from the popup to the batchdate of table rspcprocesslog
    Press F8 to display the entries of table rspcprocesslog.
    Now open another session and goto transaction se37. Enter RSPC_PROCESS_FINISH as the name of the function module and run the fm in test mode.
    Now copy the entries of table rspcprocesslog to the input parameters of the function module like described as follows:
    1. rspcprocesslog-log_id -> i_logid
    2. rspcprocesslog-type -> i_type
    3. rspcprocesslog-variante -> i_variant
    4. rspcprocesslog-instance -> i_instance
    5. enter 'G' for parameter i_state (sets the status to green).
    Now press F8 to run the fm.
    Now the actual process will be set to green and the following process in the chain will be started and the chain can run to the end.
    Of course you can also set the state of a specific step in the chain to any other possible value like 'R' = ended with errors, 'F' = finished, 'X' = cancelled ....
    Check out the value help on field rspcprocesslog-state in transaction se16 for the possible values.
    Query performance tuning
    General tips
    Using aggregates and compression.
    Using  less and complex cell definitions if possible.
    1. Avoid using too many nav. attr
    2. Avoid RKF and CKF
    3. Many chars in row.
    By using T-codes ST03 or ST03N
    Go to transaction ST03 > switch to expert mode > from left side menu > and there in system load history and distribution for a particual day > check query execution time.
    /people/andreas.vogel/blog/2007/04/08/statistical-records-part-4-how-to-read-st03n-datasets-from-db-in-nw2004
    /people/andreas.vogel/blog/2007/03/16/how-to-read-st03n-datasets-from-db
    Try table rsddstats to get the statistics
    Using cache memoery will decrease the loading time of the report.
    Run reporting agent at night and sending results to email.This will ensure use of OLAP cache. So later report execution will retrieve the result faster from the OLAP cache.
    Also try
    1.  Use different parameters in ST03 to see the two important parameters aggregation ratio and records transferred to F/E to DB selected.
    2. Use the program SAP_INFOCUBE_DESIGNS (Performance of BW infocubes) to see the aggregation ratio for the cube. If the cube does not appear in the list of this report, try to run RSRV checks on the cube and aggregates.
    Go to SE38 > Run the program SAP_INFOCUBE_DESIGNS
    It will shown dimension Vs Fact tables Size in percent.If you mean speed of queries on a cube as performance metric of cube,measure query runtime.
    3. --- sign is the valuation of the aggregate. You can say -3 is the valuation of the aggregate design and usage. ++ means that its compression is good and access is also more (in effect, performance is good). If you check its compression ratio, it must be good. -- means the compression ratio is not so good and access is also not so good (performance is not so good).The more is the positives...more is useful the aggregate and more it satisfies the number of queries. The greater the number of minus signs, the worse the evaluation of the aggregate. The larger the number of plus signs, the better the evaluation of the aggregate.
    if "-----" then it means it just an overhead. Aggregate can potentially be deleted and "+++++" means Aggregate is potentially very useful.
    Refer.
    http://help.sap.com/saphelp_nw70/helpdata/en/b8/23813b310c4a0ee10000000a114084/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/60/f0fb411e255f24e10000000a1550b0/frameset.htm
    4. Run your query in RSRT and run the query in the debug mode. Select "Display Aggregates Found" and "Do not use cache" in the debug mode. This will tell you if it hit any aggregates while running. If it does not show any aggregates, you might want to redesign your aggregates for the query.
    Also your query performance can depend upon criteria and since you have given selection only on one infoprovider...just check if you are selecting huge amount of data in the report
    Check for the query read mode in RSRT.(whether its A,X or H)..advisable read mode is X.
    5. In BI 7 statistics need to be activated for ST03 and BI admin cockpit to work.
    By implementing BW Statistics Business Content - you need to install, feed data and through ready made reports which for analysis.
    http://help.sap.com/saphelp_nw70/helpdata/en/26/4bc0417951d117e10000000a155106/frameset.htm
    /people/vikash.agrawal/blog/2006/04/17/query-performance-150-is-aggregates-the-way-out-for-me
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1955ba90-0201-0010-d3aa-8b2a4ef6bbb2
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ce7fb368-0601-0010-64ba-fadc985a1f94
    http://help.sap.com/saphelp_nw04/helpdata/en/c1/0dbf65e04311d286d6006008b32e84/frameset.htm
    You can go to T-Code DB20 which gives you all the performance related information like
    Partitions
    Databases
    Schemas
    Buffer Pools
    Tablespaces etc
    use tool RSDDK_CHECK_AGGREGATE in se38 to check for the corrupt aggregates
    If aggregates contain incorrect data, you must regenerate them.
    Note 646402 - Programs for checking aggregates (as of BW 3.0B SP15)
    Thanks,
    JituK

  • Query performance vs MySQL

    I have a table with about 500 million records in it stored within both Oracle and MySQL (MyISAM). I have a column (say phone_number) with a standard b-tree index on it in both places. Without data or indexes cached (not enough memory to fully cache the index), I run about 10,000 queries using randomly generated phone numbers as criteria in 10 concurrent threads. It seems that the average time to retrieve a record in MySQL is about 200 milliseconds whereas in Oracle it is about 400 milliseconds. I'm just wondering if MyISAM/MySQL is inherently faster for a basic index search than Oracle is, or should I be able to tune Oracle to get comparable performance.
    Of course the hardware configurations and storage configurations are the same. It's not the absolute time I'm concerned about here but the relative time. Twice as long to perform basically the same query seems concerning. I enabled tracing and it seems like some of the problem may be the recursive calls Oracle is making. Is there some way to optimize this a bit further?
    Realize, I just want to look at query performance right now...ignoring all of the issues (locking, transactional integrity, etc.)
    Thanks,
    Greg

    In Oracle, a standard table is heap-organized. A b-tree index then contains index keys and ROWIDs, so if you need to read a particular row in the table, you first do a few I/O's on the index to get the ROWIDs and then look up the ROWIDs in the table. For any given key, ROWIDs are likely to be scattered throughout the table, so this latter step generally involves multiple scattered I/O's.
    You can create an index-organized table or a hash cluster in Oracle in order to minimize the cost of this particular sort of lookup by clustering data with the same key physically near each other and, in the case of IOTs, potentially eliminating the need to store the index and table separately. Of course, there are costs to doing this in that inserts are now more expensive and secondary indexes are likely to be less useful. That probably gets you closer to what MySQL is doing if, as ajallen indicates, a MySQL table is generally stored more like an IOT than a heap-organized table.
    If you get really creative, you could even partition this single table to potentially improve performance further.
    Of course, if you're only storing one table, I'm not sure that you could really justify the cost of an Oracle license. This may well be the case where MySQL is more than sufficient for what this particular customer needs (knowing, nothing, of course, about the other requirements for the system).
    Justin

  • Inventory Ageing query performance

    Hi All,
       I have created inventory ageing query on our custom cube which is replica of 0IC_C03. We have data from 2003 onwards. the performance of the query is very poor the system almost hangs. I tried to create aggregates to improve performance but its failed. What i should do to improve the performance and why the aggregate filling is failed. Cube have compressed data. Pls guide.
    Regards:
    Jitendra

    Inaddition to the above posts
    Check the below points ... and take action accordingly to increase the query performance.
    mainly check --Is the Cube data Compressed. it will increase the performance of the query..
    1)If exclusions exist, make sure they exist in the global filter area. Try to remove exclusions by subtracting out inclusions.
    2)Check code for all exit variables used in a report.
    3)Check the read mode for the query. recommended is H.
    4)If Alternative UOM solution is used, turn off query cache.
    5)Use Constant Selection instead of SUMCT and SUMGT within formulas.
    6)Check aggregation and exception aggregation on calculated key figures. Before aggregation is generally slower and should not be used unless explicitly needed.
    7)Check if large hierarchies are used and the entry hierarchy level is as deep as possible. This limits the levels of the hierarchy that must be processed.
    Use SE16 on the inclusion tables and use the List of Value feature on the column successor and predecessor to see which entry level of the hierarchy is used.
    8)Within the free characteristics, filter on the least granular objects first and make sure those come first in the order.
    9)If hierarchies are used, minimize the number of nodes to include in the query results. Including all nodes in the query results (even the ones that are not needed or blank) slows down the query processing.
    10)Check the user exits usage involved in OLAP run time?
    11)Use Constant Selection instead of SUMCT and SUMGT within formulas.
    12)
    Turn on the BW Statistics: RSA1, choose Tools -> BW statistics for InfoCubes(Choose OLAP and WHM for your relevant Cubes)
    To check the Query Performance problem
    Use ST03N -> BW System load values to recognize the problem. Use the number given in table 'Reporting - InfoCubes:Share of total time (s)' to check if one of the columns %OLAP, %DB, %Frontend shows a high number in all InfoCubes.
    You need to run ST03N in expert mode to get these values
    based on the analysis and the values taken from the above  - Check if an aggregate is suitable or setting OLAP etc.
    Edited by: prashanthk on Nov 26, 2010 9:17 AM

  • Structures Vs RKFs and CKFs In Query performance

    Hi Gurus,
    I am creating a GL query which will be returning with a couple of KFs and some calculations as well with different GL accounts and I wanted to know which one is going to be more beneficial for me either to create Restricted keyfigures and Calculated Keyfigures or to just use a structure for all the selections and formula calculations?
    Which option will be better for query performance?
    Thanks in advance

    As compared to formulas that are evaluated during query execution, calculated key figures are pre-calculated and their definitions are stored in the metadata repository for reuse in queries. The incorporation of business metrics and key performance indicators as calculated key figures, such as gross profit and return on investment (which are frequently used, widely understood, and rarely changed), improve query performance and ensure that calculated key figures are reported consistently by different users. Note that this approach improves query runtime performance but slows InfoCube or ODS object update time. As a rule of thumb, if multiple and frequently used queries use the same formula to compute calculated fields, use calculated key figures instead of formulas.
    RKFs result in additional database processing and complexity in retrieving the query result and therefore should be avoided when possible.

  • Poor query performance in Prod.

    I am facing lots of issues in my queries.
    The query is working fine in Dev. but after i transported it to Prod. the query is taking too much time to retreive the result.
    Why i am facing this issue.
    How can i do the performance tuning for the query.?
    The query is built on multiprovider and it is also jumping to the ODS for ODS query.
    But the query performance is really low and poor in Production.
    And to surprise the query is wroking perfectly and faster in Dev.
    What can be the suggestion.
    Please send documents for performnace tuning, notes number... etc.

    Are datavolumes huge in Prod Box...dat may be cause 4 d slow runtimes.
    <b>Look at below performance improving techs</b>
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cbd2d390-0201-0010-8eab-a8a9269a23c2
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/aec09790-0201-0010-8eb9-e82df5763455
    Business Intelligence Performance Tuning [original link is broken]
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cccad390-0201-0010-5093-fd9ec8157802
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ce7fb368-0601-0010-64ba-fadc985a1f94
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c8c4d794-0501-0010-a693-918a17e663cc
    Note 565725 - Optimizing the performance of ODS objects

  • Query performance decreases dramatically after replacing equal clause

    I have a Select statement that performs well as long as I join the project code to a fixed value in the WHERE clause.
    But when this fixed value is replaced by a sub SELECT (which in fact retrieves that same fixed value) the result of the query takes 5 minutes longer.
    It's Oracle 8i database.
    It's not clear to me why Oracle follows a complete other execution plan and also introduces a lot of FULL table scans with such a minor change
    Select statement and explain plan with fixed value in WHERE
    SELECT PVN.PJT_CODE                                            PJT_CODE
         , L_PJT.DESCRIPTION                                       PJT_DESCRIPTION
         , PVN.CODE                                                VERSION
         , PVN.DESCRIPTION                                         VERSION_DESCRIPTION
    --   , NVL(L_PJT.EXRATE_TENDER, 1)                             EXRATE_TENDER
         , KBA.BQI_CODE                                            BOQ_ITEM
          , KBA.BQI_DESCRIPTION                                     BOQ_ITEM_DESCRIPTION
          , KBA.BQI_QUANTITY                                        BOQ_ITEM_PAID_QUANTITY
          , KBA.BQI_UNIT                                            BOQ_ITEM_UNIT
    --      , KBA.PVN_CODE PVN_CODE1
    --      , KBA.PJT_CODE PJT_CODE2
         , KGW.ACT_CODE                                            ACT_CODE
         , KGW.DESCRIPTION                                         ACT_DESCRIPTION
         , ROUND(KGW.EXECUTED)                                     ACT_EXECUTED_QUANTITY
         , KGW.UNIT_EXEC                                           ACT_EXECUTED_UNIT
         , ROUND(KGW.PAID)                                         ACT_PAID_QUANTITY
         , NVL(KGW.UNIT_PAID, KGW.UNIT_EXEC)                       ACT_PAID_UNIT
         , KGW.HOURS_WEEK                                          ACT_HOURS_WEEK                             
         , KGW.PROD_HOUR                                           ACT_PROD_HOUR
         , KGW.HOURS_WEEK * KGW.PROD_HOUR                          ACT_PROD_WEEK
         , NVL(KGW.WEEKS, 1)                                       ACT_TOTAL_WEEKS -- WKUI: NVL, 1 toepassen.
         , KGW.MY_CODE                                             ACT_MY_CODE
         , NVL(L_EQT.DESCRIPTION, WCS.DESCRIPTION)                 WCS_DESCRIPTION
         , IAE.WCA_PJT_CODE                                        WCA_PJT_CODE
         , IAE.WCA_CODE                                            WCA_CODE
         , IAE.QUANTITY                                            QUANTITY
         , IAE.STANDBY_IDLE
         , WCS.CODE                                                WCS_CODE
         , WCS.SQT_CODE                                            WCS_SQT_CODE
         , WCA.WCA_TYPE        
         , Kcs_Bqm_Dml.calc_wcs_costs
           ( iae.wca_pjt_code
           , wcs.code
           , kgw.hours_week
           , iae.standby_idle
           , iae.quantity
           , wcs.sqt_code
           , Kcs_Bqm_Dml.calc_working_weeks ( kgw.my_code
                                            , kgw.pjt_code
                                            , kgw.act_code
                                            , kgw.pvn_code
      FROM KCS_PROJECT_VERSIONS     PVN
         , PRR_PROJECTS             L_PJT
          , KCS_BOQ_ACT_VW           KBA
          , KCS_GAY_WCA_VW           KGW
         , KCS_INTS_WCA_WCS         IAE
         , KCS_WEEKLY_COST_ACTIVITIES WCA
         , KCS_WEEKLY_COST_SPECIFICATIONS WCS
         , KCS_EQUIPMENT L_EQT
    WHERE PVN.PJT_CODE           = L_PJT.CODE
       AND L_PJT.CODE             IN ( '04.748' )
       AND PVN.CODE               = 'A'
       AND KBA.PJT_CODE           = PVN.PJT_CODE
       AND KBA.PVN_CODE           = PVN.CODE
       AND KGW.PJT_CODE           = PVN.PJT_CODE
       AND KGW.PVN_CODE           = PVN.CODE
       AND KGW.BQI_CODE           = KBA.BQI_CODE
       AND KGW.ACT_CODE           = WCA.CODE
       AND KGW.PJT_CODE           = WCA.PJT_CODE
       AND IAE.WCS_CODE           = WCS.CODE
       AND IAE.WCS_PJT_CODE       = WCS.PJT_CODE
       AND WCS.EQT_CODE           = L_EQT.CODE (+) 
       AND WCA.PJT_CODE           = IAE.WCS_PJT_CODE
       AND WCA.CODE               = IAE.WCA_CODE
       AND WCA.WCA_TYPE           = 'PAY'
    ORDER BY PVN.PJT_CODE
           , PVN.CODE
           , KBA.BQI_CODE
            , KGW.ACT_CODE
           , wcs.codeFast explain plan: OKAY
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE          1             270                                          
      SORT ORDER BY          1       328       270                                          
        NESTED LOOPS OUTER          1       328       269                                          
          NESTED LOOPS          1       313       268                                          
            HASH JOIN          1       259       116                                          
              HASH JOIN          4       528       89                                          
                NESTED LOOPS          28       3 K     78                                          
                  NESTED LOOPS          23       2 K     9                                          
                    NESTED LOOPS          1       58       3                                          
                      TABLE ACCESS BY INDEX ROWID     PRR.PRR_PROJECTS     1       26       2                                          
                        INDEX UNIQUE SCAN     PRR.PRR_PJT_PK     1             1                                          
                      TABLE ACCESS BY INDEX ROWID     KCS.KCS_PROJECT_VERSIONS     1       32       1                                          
                        INDEX UNIQUE SCAN     KCS.KCS_PVN_PK     1                                                      
                    TABLE ACCESS BY INDEX ROWID     KCS.KCS_WEEKLY_COST_SPECIFICATIONS     23       897       6                                          
                      INDEX RANGE SCAN     KCS.KCS_WCS_PJT_FK     23             2                                          
                  TABLE ACCESS BY INDEX ROWID     KCS.KCS_INTS_WCA_WCS     124       2 K     3                                          
                    INDEX RANGE SCAN     KCS.KCS_IAE_WCS_FK     124             2                                          
                TABLE ACCESS BY INDEX ROWID     KCS.KCS_WEEKLY_COST_ACTIVITIES     18       234       10                                          
                  INDEX RANGE SCAN     KCS.KCS_WCA_PJT_FK     18             3                                          
              VIEW     KCS.KCS_GAY_WCA_VW     3       381       27                                          
                SORT UNIQUE          3       229       27                                          
                  UNION-ALL                                                                
                    NESTED LOOPS          1       75       9                                          
                      NESTED LOOPS          1       72       9                                          
                        NESTED LOOPS          1       58       7                                          
                          TABLE ACCESS BY INDEX ROWID     KCS.KCS_GENERAL_ACTIVITIES     1       45       4                                          
                            INDEX RANGE SCAN     KCS.KCS_GAY_PK     1             3                                          
                          TABLE ACCESS BY INDEX ROWID     KCS.KCS_GENERAL_SPECIFICATIONS     4       52       3                                          
                            INDEX RANGE SCAN     KCS.KCS_GSN_GAY_FK     4             2                                          
                        INDEX RANGE SCAN     KCS.KCS_ISC_GSN_FK     5       70       2                                          
                      INDEX UNIQUE SCAN     KCS.KCS_SCG_PK     20       60                                                
                    NESTED LOOPS          1       66       5                                          
                      NESTED LOOPS          1       63       5                                          
                        TABLE ACCESS BY INDEX ROWID     KCS.KCS_INTS_GAY_SCT     1       18       3                                          
                          INDEX RANGE SCAN     KCS.KCS_IAC_GAY_FK     1             2                                          
                        TABLE ACCESS BY INDEX ROWID     KCS.KCS_GENERAL_ACTIVITIES     1       45       2                                          
                          INDEX UNIQUE SCAN     KCS.KCS_GAY_PK     1             1                                          
                      INDEX UNIQUE SCAN     KCS.KCS_SCG_PK     20       60                                                
                    NESTED LOOPS          1       88       7                                          
                      NESTED LOOPS          1       84       6                                          
                        TABLE ACCESS BY INDEX ROWID     KCS.KCS_INTS_WCA_PVN     1       22       4                                          
                          INDEX RANGE SCAN     KCS.KCS_IAV_PVN_FK     1             3                                          
                        TABLE ACCESS BY INDEX ROWID     KCS.KCS_WEEKLY_COST_ACTIVITIES     71 K     4 M     2                                          
                          INDEX UNIQUE SCAN     KCS.KCS_WCA_PK     71 K           1                                          
                      TABLE ACCESS BY INDEX ROWID     KCS.KCS_SYS_COST_GROUP     20       80       1                                          
                        INDEX UNIQUE SCAN     KCS.KCS_SCG_PK     20                                                      
            VIEW     KCS.KCS_BOQ_ACT_VW     2       108                                                
              SORT UNIQUE          2       102       153                                          
                UNION-ALL                                                                
                  NESTED LOOPS          1       51       113                                          
                    TABLE ACCESS BY INDEX ROWID     KCS.KCS_BOQ_ITEMS     27       1 K     5                                          
                      INDEX RANGE SCAN     KCS.KCS_BQI_PJT_FK     27             3                                          
                    TABLE ACCESS BY INDEX ROWID     KCS.KCS_GENERAL_ACTIVITIES     1       12       4                                          
                      INDEX RANGE SCAN     KCS.KCS_GAY_BQI_FK     1             2                                          
                  NESTED LOOPS          1       51       36                                          
                    TABLE ACCESS BY INDEX ROWID     KCS.KCS_INTS_WCA_PVN     1       12       34                                          
                      INDEX RANGE SCAN     KCS.KCS_IAV_BQI_FK     1             3                                          
                    TABLE ACCESS BY INDEX ROWID     KCS.KCS_BOQ_ITEMS     27       1 K     2                                          
                      INDEX UNIQUE SCAN     KCS.KCS_BQI_PK     27             1                                          
          TABLE ACCESS BY INDEX ROWID     KCS.KCS_EQUIPMENT     1 K     17 K     1                                          
            INDEX UNIQUE SCAN     KCS.KCS_EQT_PK     1 K                                                     Select statement and explain plan with subselect in WHERE
    SELECT PVN.PJT_CODE                                            PJT_CODE
         , L_PJT.DESCRIPTION                                       PJT_DESCRIPTION
         , PVN.CODE                                                VERSION
         , PVN.DESCRIPTION                                         VERSION_DESCRIPTION
    --   , NVL(L_PJT.EXRATE_TENDER, 1)                             EXRATE_TENDER
         , KBA.BQI_CODE                                            BOQ_ITEM
          , KBA.BQI_DESCRIPTION                                     BOQ_ITEM_DESCRIPTION
          , KBA.BQI_QUANTITY                                        BOQ_ITEM_PAID_QUANTITY
          , KBA.BQI_UNIT                                            BOQ_ITEM_UNIT
    --      , KBA.PVN_CODE PVN_CODE1
    --      , KBA.PJT_CODE PJT_CODE2
         , KGW.ACT_CODE                                            ACT_CODE
         , KGW.DESCRIPTION                                         ACT_DESCRIPTION
         , ROUND(KGW.EXECUTED)                                     ACT_EXECUTED_QUANTITY
         , KGW.UNIT_EXEC                                           ACT_EXECUTED_UNIT
         , ROUND(KGW.PAID)                                         ACT_PAID_QUANTITY
         , NVL(KGW.UNIT_PAID, KGW.UNIT_EXEC)                       ACT_PAID_UNIT
         , KGW.HOURS_WEEK                                          ACT_HOURS_WEEK                             
         , KGW.PROD_HOUR                                           ACT_PROD_HOUR
         , KGW.HOURS_WEEK * KGW.PROD_HOUR                          ACT_PROD_WEEK
         , NVL(KGW.WEEKS, 1)                                       ACT_TOTAL_WEEKS -- WKUI: NVL, 1 toepassen.
         , KGW.MY_CODE                                             ACT_MY_CODE
         , NVL(L_EQT.DESCRIPTION, WCS.DESCRIPTION)                 WCS_DESCRIPTION
         , IAE.WCA_PJT_CODE                                        WCA_PJT_CODE
         , IAE.WCA_CODE                                            WCA_CODE
         , IAE.QUANTITY                                            QUANTITY
         , IAE.STANDBY_IDLE
         , WCS.CODE                                                WCS_CODE
         , WCS.SQT_CODE                                            WCS_SQT_CODE
         , WCA.WCA_TYPE        
         , Kcs_Bqm_Dml.calc_wcs_costs
           ( iae.wca_pjt_code
           , wcs.code
           , kgw.hours_week
           , iae.standby_idle
           , iae.quantity
           , wcs.sqt_code
           , Kcs_Bqm_Dml.calc_working_weeks ( kgw.my_code
                                            , kgw.pjt_code
                                            , kgw.act_code
                                            , kgw.pvn_code
      FROM KCS_PROJECT_VERSIONS     PVN
         , PRR_PROJECTS             L_PJT
          , KCS_BOQ_ACT_VW           KBA
          , KCS_GAY_WCA_VW           KGW
         , KCS_INTS_WCA_WCS         IAE
         , KCS_WEEKLY_COST_ACTIVITIES WCA
         , KCS_WEEKLY_COST_SPECIFICATIONS WCS
         , KCS_EQUIPMENT L_EQT
    WHERE PVN.PJT_CODE           = L_PJT.CODE
       AND L_PJT.CODE             = (SELECT EMP.PJT_CODE FROM PRR_EMPLOYEES EMP WHERE EMP.INITIALS = USER) /* <-- This is the only difference with previous query, columns are indexed, and result is same as dixed value */
       AND PVN.CODE               = 'A'
       AND KBA.PJT_CODE           = PVN.PJT_CODE
       AND KBA.PVN_CODE           = PVN.CODE
       AND KGW.PJT_CODE           = PVN.PJT_CODE
       AND KGW.PVN_CODE           = PVN.CODE
       AND KGW.BQI_CODE           = KBA.BQI_CODE
       AND KGW.ACT_CODE           = WCA.CODE
       AND KGW.PJT_CODE           = WCA.PJT_CODE
       AND IAE.WCS_CODE           = WCS.CODE
       AND IAE.WCS_PJT_CODE       = WCS.PJT_CODE
       AND WCS.EQT_CODE           = L_EQT.CODE (+) 
       AND WCA.PJT_CODE           = IAE.WCS_PJT_CODE
       AND WCA.CODE               = IAE.WCA_CODE
       AND WCA.WCA_TYPE           = 'PAY'
    ORDER BY PVN.PJT_CODE
           , PVN.CODE
           , KBA.BQI_CODE
            , KGW.ACT_CODE
           , wcs.codeExpensive explain plan BAD
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE          1             5052                                          
      SORT ORDER BY          1       328       5052                                          
        NESTED LOOPS OUTER          1       328       5051                                          
          NESTED LOOPS          1       313       5050                                          
            NESTED LOOPS          1       274       5048                                          
              NESTED LOOPS          1       252       4677                                          
                NESTED LOOPS          1       239       4675                                          
                  NESTED LOOPS          1       185       3418                                          
                    NESTED LOOPS          1       58       3                                          
                      TABLE ACCESS BY INDEX ROWID     PRR.PRR_PROJECTS     1       26       2                                          
                        INDEX UNIQUE SCAN     PRR.PRR_PJT_PK     1             1                                          
                          TABLE ACCESS BY INDEX ROWID     PRR.PRR_EMPLOYEES     1       7       1                                          
                            INDEX UNIQUE SCAN     PRR.PRR_EME_PK     2                                                      
                      TABLE ACCESS BY INDEX ROWID     KCS.KCS_PROJECT_VERSIONS     41       1 K     1                                          
                        INDEX UNIQUE SCAN     KCS.KCS_PVN_PK     41                                                      
                    VIEW     KCS.KCS_GAY_WCA_VW     471       58 K                                              
                      SORT UNIQUE          471       40 K     3416                                          
                        UNION-ALL                                                                
                          NESTED LOOPS          1       75       2143                                          
                            NESTED LOOPS          6       366       2131                                          
                              HASH JOIN          6       348       2131                                          
                                TABLE ACCESS FULL     KCS.KCS_GENERAL_ACTIVITIES     713       31 K     558                                          
                                INDEX FAST FULL SCAN     KCS.KCS_GSN_PK     5 K     74 K     1546                                          
                              INDEX UNIQUE SCAN     KCS.KCS_SCG_PK     20       60                                                
                            INDEX RANGE SCAN     KCS.KCS_ISC_GSN_FK     6 K     91 K     2                                          
                          NESTED LOOPS          1       66       298                                          
                            NESTED LOOPS          1       63       298                                          
                              TABLE ACCESS FULL     KCS.KCS_INTS_GAY_SCT     131       2 K     36                                          
                              TABLE ACCESS BY INDEX ROWID     KCS.KCS_GENERAL_ACTIVITIES     713       31 K     2                                          
                                INDEX UNIQUE SCAN     KCS.KCS_GAY_PK     713             1                                          
                            INDEX UNIQUE SCAN     KCS.KCS_SCG_PK     20       60                                                
                          HASH JOIN          469       40 K     955                                          
                            TABLE ACCESS FULL     KCS.KCS_SYS_COST_GROUP     20       80       1                                          
                            HASH JOIN          469       38 K     952                                          
                              TABLE ACCESS FULL     KCS.KCS_INTS_WCA_PVN     420       9 K     169                                          
                              TABLE ACCESS FULL     KCS.KCS_WEEKLY_COST_ACTIVITIES     71 K     4 M     490                                          
                  VIEW     KCS.KCS_BOQ_ACT_VW     1 K     62 K                                              
                    SORT UNIQUE          1 K     59 K     1258                                          
                      UNION-ALL                                                                
                        HASH JOIN          748       37 K     847                                          
                          TABLE ACCESS FULL     KCS.KCS_GENERAL_ACTIVITIES     713       8 K     558                                          
                          TABLE ACCESS FULL     KCS.KCS_BOQ_ITEMS     51 K     1 M     107                                          
                        HASH JOIN          440       21 K     385                                          
                          TABLE ACCESS FULL     KCS.KCS_INTS_WCA_PVN     420       4 K     169                                          
                          TABLE ACCESS FULL     KCS.KCS_BOQ_ITEMS     51 K     1 M     107                                          
                TABLE ACCESS BY INDEX ROWID     KCS.KCS_WEEKLY_COST_ACTIVITIES     35 K     454 K     2                                          
                  INDEX UNIQUE SCAN     KCS.KCS_WCA_PK     35 K           1                                          
              TABLE ACCESS FULL     KCS.KCS_INTS_WCA_WCS     270 K     5 M     371                                          
            TABLE ACCESS BY INDEX ROWID     KCS.KCS_WEEKLY_COST_SPECIFICATIONS     74 K     2 M     2                                          
              INDEX UNIQUE SCAN     KCS.KCS_WCS_PK     74 K           1                                          
          TABLE ACCESS BY INDEX ROWID     KCS.KCS_EQUIPMENT     1 K     17 K     1                                          
            INDEX UNIQUE SCAN     KCS.KCS_EQT_PK     1 K                                                     I hope someone can give a clue
    Thanks in advance
    Auke Quist

    In order to get more helpfull messages i used utlxpls.sql to format the plan table:
    First the query where I hardcoded the assignment of the project code (this leads to fast result in 841 msecs)
    Query with_assigned_project:
    SELECT PVN.PJT_CODE                                            PJT_CODE
         , L_PJT.DESCRIPTION                                       PJT_DESCRIPTION
         , PVN.CODE                                                VERSION
         , PVN.DESCRIPTION                                         VERSION_DESCRIPTION
         , KBA.BQI_CODE                                            BOQ_ITEM
          , KBA.BQI_DESCRIPTION                                     BOQ_ITEM_DESCRIPTION
          , KBA.BQI_QUANTITY                                        BOQ_ITEM_PAID_QUANTITY
          , KBA.BQI_UNIT                                            BOQ_ITEM_UNIT
         , KGW.ACT_CODE                                            ACT_CODE
         , KGW.DESCRIPTION                                         ACT_DESCRIPTION
         , ROUND(KGW.EXECUTED)                                     ACT_EXECUTED_QUANTITY
         , KGW.UNIT_EXEC                                           ACT_EXECUTED_UNIT
         , ROUND(KGW.PAID)                                         ACT_PAID_QUANTITY
         , NVL(KGW.UNIT_PAID, KGW.UNIT_EXEC)                       ACT_PAID_UNIT
         , KGW.HOURS_WEEK                                          ACT_HOURS_WEEK                             
         , KGW.PROD_HOUR                                           ACT_PROD_HOUR
         , KGW.HOURS_WEEK * KGW.PROD_HOUR                          ACT_PROD_WEEK
         , NVL(KGW.WEEKS, 1)                                       ACT_TOTAL_WEEKS -- WKUI: NVL, 1 toepassen.
         , KGW.MY_CODE                                             ACT_MY_CODE
      FROM KCS_PROJECT_VERSIONS     PVN
          , KCS_BOQ_ACT_VW           KBA
          , KCS_GAY_WCA_VW           KGW
         , PRR_PROJECTS             L_PJT
    WHERE PVN.PJT_CODE           = L_PJT.CODE
       AND L_PJT.CODE             = '04.748'
       AND KBA.PJT_CODE           = PVN.PJT_CODE
       AND KBA.PVN_CODE           = PVN.CODE
       AND KGW.PJT_CODE           = PVN.PJT_CODE
       AND KGW.PVN_CODE           = PVN.CODE
       AND KGW.BQI_CODE           = KBA.BQI_CODE
    ORDER BY PVN.PJT_CODE
           , PVN.CODE
           , KBA.BQI_CODE
           , KGW.ACT_CODE;The explain plan is OKAY and looks like:
    Plan Table
    | Operation                           |  Name                   |  Rows | Bytes|  Cost  | Pstart| Pstop |
    | SELECT STATEMENT                    |                         |     1 |  242 |    212 |       |       |
    |  SORT ORDER BY                      |                         |     1 |  242 |    212 |       |       |
    |   NESTED LOOPS                      |                         |     1 |  242 |    211 |       |       |
    |    HASH JOIN                        |                         |     1 |  115 |     94 |       |       |
    |     NESTED LOOPS                    |                         |     3 |  183 |      5 |       |       |
    |      TABLE ACCESS BY INDEX ROWID    |PRR_PROJECTS             |     1 |   26 |      2 |       |       |
    |       INDEX UNIQUE SCAN             |PRR_PJT_PK               |     1 |      |      1 |       |       |
    |      TABLE ACCESS BY INDEX ROWID    |KCS_PROJECT_VERSIONS     |     3 |  105 |      3 |       |       |
    |       INDEX RANGE SCAN              |KCS_PVN_PJT_FK           |     3 |      |      1 |       |       |
    |     VIEW                            |KCS_BOQ_ACT_VW           |    30 |    1K|     89 |       |       |
    |      SORT UNIQUE                    |                         |    30 |    1K|     89 |       |       |
    |       UNION-ALL                     |                         |       |      |        |       |       |
    |        NESTED LOOPS                 |                         |    15 |  885 |     64 |       |       |
    |         TABLE ACCESS BY INDEX ROWID |KCS_BOQ_ITEMS            |    15 |  660 |      4 |       |       |
    |          INDEX RANGE SCAN           |KCS_BQI_PJT_FK           |    15 |      |      3 |       |       |
    |         TABLE ACCESS BY INDEX ROWID |KCS_GENERAL_ACTIVITIES   |    50 |  750 |      4 |       |       |
    |          INDEX RANGE SCAN           |KCS_GAY_BQI_FK           |    50 |      |      2 |       |       |
    |        HASH JOIN                    |                         |    15 |  885 |     21 |       |       |
    |         TABLE ACCESS BY INDEX ROWID |KCS_BOQ_ITEMS            |    15 |  660 |      4 |       |       |
    |          INDEX RANGE SCAN           |KCS_BQI_PJT_FK           |    15 |      |      3 |       |       |
    |         TABLE ACCESS BY INDEX ROWID |KCS_INTS_WCA_PVN         |    31 |  465 |     16 |       |       |
    |          INDEX RANGE SCAN           |KCS_IAV_BQI_FK           |    31 |      |      3 |       |       |
    |    VIEW                             |KCS_GAY_WCA_VW           |    33 |    4K|        |       |       |
    |     SORT UNIQUE                     |                         |    33 |    3K|    118 |       |       |
    |      UNION-ALL                      |                         |       |      |        |       |       |
    |       NESTED LOOPS                  |                         |     1 |   90 |     17 |       |       |
    |        NESTED LOOPS                 |                         |     1 |   86 |     17 |       |       |
    |         HASH JOIN                   |                         |     1 |   35 |     15 |       |       |
    |          INDEX RANGE SCAN           |KCS_GSN_PK               |   403 |    6K|      6 |       |       |
    |          INDEX RANGE SCAN           |KCS_ISC_GSN_FK           |   497 |    8K|      6 |       |       |
    |         TABLE ACCESS BY INDEX ROWID |KCS_GENERAL_ACTIVITIES   |    50 |    2K|      2 |       |       |
    |          INDEX UNIQUE SCAN          |KCS_GAY_PK               |    50 |      |      1 |       |       |
    |        INDEX UNIQUE SCAN            |KCS_SCG_PK               |    20 |   80 |        |       |       |
    |       NESTED LOOPS                  |                         |     1 |   78 |     24 |       |       |
    |        HASH JOIN                    |                         |     1 |   74 |     24 |       |       |
    |         TABLE ACCESS BY INDEX ROWID |KCS_INTS_GAY_SCT         |    19 |  437 |      4 |       |       |
    |          INDEX RANGE SCAN           |KCS_IAC_GAY_FK           |    19 |      |      2 |       |       |
    |         TABLE ACCESS BY INDEX ROWID |KCS_GENERAL_ACTIVITIES   |    50 |    2K|     19 |       |       |
    |          INDEX RANGE SCAN           |KCS_GAY_PVN_FK           |    50 |      |      3 |       |       |
    |        INDEX UNIQUE SCAN            |KCS_SCG_PK               |    20 |   80 |        |       |       |
    |       HASH JOIN                     |                         |    31 |    3K|     71 |       |       |
    |        NESTED LOOPS                 |                         |    31 |    2K|     69 |       |       |
    |         TABLE ACCESS BY INDEX ROWID |KCS_INTS_WCA_PVN         |    31 |  837 |      7 |       |       |
    |          INDEX RANGE SCAN           |KCS_IAV_PVN_FK           |    31 |      |      3 |       |       |
    |         TABLE ACCESS BY INDEX ROWID |KCS_WEEKLY_COST_ACTIVITI |    71K|    4M|      2 |       |       |
    |          INDEX UNIQUE SCAN          |KCS_WCA_PK               |    71K|      |      1 |       |       |
    |        TABLE ACCESS FULL            |KCS_SYS_COST_GROUP       |    20 |  120 |      1 |       |       |
    ---------------------------------------------------------------------------------------------------------Secondly the query where I derived the the project code (this leads to a slow result in 10.6 minutes)
    Query with_assigned_project:
    SELECT PVN.PJT_CODE                                            PJT_CODE
         , L_PJT.DESCRIPTION                                       PJT_DESCRIPTION
         , PVN.CODE                                                VERSION
         , PVN.DESCRIPTION                                         VERSION_DESCRIPTION
         , KBA.BQI_CODE                                            BOQ_ITEM
          , KBA.BQI_DESCRIPTION                                     BOQ_ITEM_DESCRIPTION
          , KBA.BQI_QUANTITY                                        BOQ_ITEM_PAID_QUANTITY
          , KBA.BQI_UNIT                                            BOQ_ITEM_UNIT
         , KGW.ACT_CODE                                            ACT_CODE
         , KGW.DESCRIPTION                                         ACT_DESCRIPTION
         , ROUND(KGW.EXECUTED)                                     ACT_EXECUTED_QUANTITY
         , KGW.UNIT_EXEC                                           ACT_EXECUTED_UNIT
         , ROUND(KGW.PAID)                                         ACT_PAID_QUANTITY
         , NVL(KGW.UNIT_PAID, KGW.UNIT_EXEC)                       ACT_PAID_UNIT
         , KGW.HOURS_WEEK                                          ACT_HOURS_WEEK                             
         , KGW.PROD_HOUR                                           ACT_PROD_HOUR
         , KGW.HOURS_WEEK * KGW.PROD_HOUR                          ACT_PROD_WEEK
         , NVL(KGW.WEEKS, 1)                                       ACT_TOTAL_WEEKS -- WKUI: NVL, 1 toepassen.
         , KGW.MY_CODE                                             ACT_MY_CODE
      FROM KCS_PROJECT_VERSIONS     PVN
          , KCS_BOQ_ACT_VW           KBA
          , KCS_GAY_WCA_VW           KGW
         , (SELECT * FROM PRR_PROJECTS WHERE CODE = (SELECT EMP.PJT_CODE FROM PRR_EMPLOYEES EMP WHERE EMP.INITIALS = USER)) L_PJT
    WHERE PVN.PJT_CODE           = L_PJT.CODE
       AND KBA.PJT_CODE           = PVN.PJT_CODE
       AND KBA.PVN_CODE           = PVN.CODE
       AND KGW.PJT_CODE           = PVN.PJT_CODE
       AND KGW.PVN_CODE           = PVN.CODE
       AND KGW.BQI_CODE           = KBA.BQI_CODE
    ORDER BY PVN.PJT_CODE
           , PVN.CODE
           , KBA.BQI_CODE
           , KGW.ACT_CODE;The explain plan is NOT OKAY for me looks like:
    Plan Table
    | Operation                           |  Name                   |  Rows | Bytes|  Cost  | Pstart| Pstop |
    | SELECT STATEMENT                    |                         |     1 |  242 | 411715 |       |       |
    |  SORT ORDER BY                      |                         |     1 |  242 | 411715 |       |       |
    |   NESTED LOOPS                      |                         |     1 |  242 | 411714 |       |       |
    |    HASH JOIN                        |                         |     1 |  188 | 378640 |       |       |
    |     NESTED LOOPS                    |                         |     3 |  183 |      4 |       |       |
    |      TABLE ACCESS BY INDEX ROWID    |PRR_PROJECTS             |     1 |   26 |      2 |       |       |
    |       INDEX UNIQUE SCAN             |PRR_PJT_PK               |     1 |      |      1 |       |       |
    |        TABLE ACCESS BY INDEX ROWID  |PRR_EMPLOYEES            |     1 |    7 |      1 |       |       |
    |         INDEX UNIQUE SCAN           |PRR_EME_PK               |     2 |      |        |       |       |
    |      TABLE ACCESS BY INDEX ROWID    |KCS_PROJECT_VERSIONS     |    10K|  345K|      2 |       |       |
    |       INDEX RANGE SCAN              |KCS_PVN_PJT_FK           |    10K|      |      1 |       |       |
    |     VIEW                            |KCS_GAY_WCA_VW           |     1M|  216M| 375247 |       |       |
    |      SORT UNIQUE                    |                         |     1M|  154M| 375247 |       |       |
    |       UNION-ALL                     |                         |       |      |        |       |       |
    |        NESTED LOOPS                 |                         |     1M|  142M|  76854 |       |       |
    |         MERGE JOIN                  |                         |     1M|  135M|  76854 |       |       |
    |          MERGE JOIN                 |                         |     1M|   55M|  64136 |       |       |
    |           SORT JOIN                 |                         |     1M|   28M|        |       |       |
    |            INDEX FAST FULL SCAN     |KCS_ISC_GSN_FK           |     1M|   28M|  13098 |       |       |
    |           SORT JOIN                 |                         |     1M|   21M|  49492 |       |       |
    |            INDEX FAST FULL SCAN     |KCS_GSN_PK               |     1M|   21M|   1546 |       |       |
    |          SORT JOIN                  |                         |   164K|    7M|  12718 |       |       |
    |           TABLE ACCESS FULL         |KCS_GENERAL_ACTIVITIES   |   164K|    7M|    558 |       |       |
    |         INDEX UNIQUE SCAN           |KCS_SCG_PK               |    20 |   80 |        |       |       |
    |        NESTED LOOPS                 |                         |    22K|    1M|  12764 |       |       |
    |         HASH JOIN                   |                         |    22K|    1M|  12764 |       |       |
    |          TABLE ACCESS FULL          |KCS_INTS_GAY_SCT         |    22K|  504K|     36 |       |       |
    |          TABLE ACCESS FULL          |KCS_GENERAL_ACTIVITIES   |   164K|    7M|    558 |       |       |
    |         INDEX UNIQUE SCAN           |KCS_SCG_PK               |    20 |   80 |        |       |       |
    |        HASH JOIN                    |                         |   105K|   10M|  10662 |       |       |
    |         TABLE ACCESS FULL           |KCS_SYS_COST_GROUP       |    20 |  120 |      1 |       |       |
    |         MERGE JOIN                  |                         |   105K|    9M|  10503 |       |       |
    |          SORT JOIN                  |                         |    71K|    4M|   6372 |       |       |
    |           TABLE ACCESS FULL         |KCS_WEEKLY_COST_ACTIVITI |    71K|    4M|    490 |       |       |
    |          SORT JOIN                  |                         |   105K|    2M|   4131 |       |       |
    |           TABLE ACCESS FULL         |KCS_INTS_WCA_PVN         |   105K|    2M|    169 |       |       |
    |    VIEW                             |KCS_BOQ_ACT_VW           |   269K|   13M|  33075 |       |       |
    |     SORT UNIQUE                     |                         |   269K|   15M|  33075 |       |       |
    |      UNION-ALL                      |                         |       |      |        |       |       |
    |       MERGE JOIN                    |                         |   164K|    9M|   7193 |       |       |
    |        SORT JOIN                    |                         |    51K|    2M|   2461 |       |       |
    |         TABLE ACCESS FULL           |KCS_BOQ_ITEMS            |    51K|    2M|    107 |       |       |
    |        SORT JOIN                    |                         |   164K|    2M|   4733 |       |       |
    |         TABLE ACCESS FULL           |KCS_GENERAL_ACTIVITIES   |   164K|    2M|    558 |       |       |
    |       MERGE JOIN                    |                         |   105K|    5M|   4841 |       |       |
    |        SORT JOIN                    |                         |    51K|    2M|   2461 |       |       |
    |         TABLE ACCESS FULL           |KCS_BOQ_ITEMS            |    51K|    2M|    107 |       |       |
    |        SORT JOIN                    |                         |   105K|    1M|   2380 |       |       |
    |         TABLE ACCESS FULL           |KCS_INTS_WCA_PVN         |   105K|    1M|    169 |       |       |
    52 rows selected.It's a bit hard to understand for me, because:
    (SELECT * FROM PRR_PROJECTS WHERE CODE = (SELECT EMP.PJT_CODE FROM PRR_EMPLOYEES EMP WHERE EMP.INITIALS = USER)) L_PJTretrieves the only project '04.748', the one I hardcoded in the first query.
    But as you can guess we do not want to work with hardcode projects, but with a project that is assisgned to the user via PRR_EMPLOYEES.PJT_CODE attribute.
    I hope someone can steer me in the right direction to solve this issue.
    Thanks in advance
    Auke Quist
    Edited by: aukequist on May 2, 2010 4:38 PM

Maybe you are looking for

  • New to Mainstage but I have one question.

    Hi guys, I'm new to Mainstage, but not to Logic. Anyway, I have one rather complicated question before I dig though all the manuals. Here is the set up that I want to achieve. My buddy has an I-Mac, I have a MacBook. What we have been doing involving

  • How can I remove Apple ID from my old Iphone? I want to sell it.

    I want to sell my Iphone, how do I need to remove my Apple Id from there. The one why buys needs to create a new Apple ID. Can I use my old Apple ID when I have a new Iphone? Thanks!

  • Dx2400 Microtower Won't Boot - Beep Codes

    Hi all, One of my users has a dx2400 microtower.  Yesterday, according to her, it just stopped working.  Upon visiting this morning, I find that when powering on, nothing is displayed on the monitor, the green light on the power button is solid, the

  • WebView not displaying my html.

    I have made a window, and its controller has this: -(id) init { if(![super initWithWindowNibName: @"Post"]) return nil; return self; -(void)windowDidLoad:(id)sender { NSLog(@"Post window opned"); [webView.mainFrame loadHTMLString:@"<html><body>hi tes

  • CS6 Project With H.264 Video Wont Open in Premiere CC

    I wonder if some one can explain to me that on the same exact system where both CS6 & now CC live, i cannot open Certain .MOV files, i believe they are H.264, in Premiere Pro CC where they Open just fine in the CS6 Prekiere Pro? Has this happened to