Strange ROWNUM result on query complex using separate results

We have a very complicated query that is a combination of implicit and explicit joins on more than 10 tables in the database. Due to performance issues and timeout if we let him return the entire result set, I'm limiting it to a number using rownum.

Initially, we were using a "select * of (select distinct * insert here * order of main by id request) where rownum < = 300 ', but work stopped when a new piece of research has been implemented that makes the whole result set then cut accepting up to 300 results for 5 minutes, which is the maximum of our web server can define for a timeout.

So I tried to change it simply to "select distinct * insert here the main query * and rownum < = 300. This is for a reason any returns only one record. If I add THAT ROWNUM to the list of displayed values it displays 300 lines of exactly the same values with different rownums, who then likely get collapsed down by the distinct in the single record that I see.

Is there a better way to do it? We can't simply not the complete set of results in a subquery to whittle down, but try to whittle down to the main request gives weird results.

A better approach would be to improve the performance of the main query. On the one hand, do come back less (or not) duplicate lines would probably improve the performance considerably, because he's back at least 300 copies of certain lines. Making a DIFFERENT one on a large number of lines can be a problem in itself huge performance.

Tags: Database

Similar Questions

  • Please suggest a select query / under query with using any routines or

    source table: three columns ORIGIN, DESTINATION, MILES

    Origin Destination Miles

    Sydney Melbourne 1000
    Perth, Adelaide 3000
    Canberra Melbounre 700
    Melbourne Sydney 1000
    Brisbane Sydney 1000
    Perth, Darwin 4000
    Sydney, Brisbane 1000

    out put: three columns ORIGIN, DESTINATION, MILES

    Duplicate routes should be ignored, so the output is

    Origin Destination Miles

    Sydney Melbourne 1000
    Perth, Adelaide 3000
    Canberra Melbounre 700
    Brisbane Sydney 1000
    Perth, Darwin 4000

    Please suggest a select query / under query with using subroutines or functions/pkgs to get put out table.

    Hello

    user9368047 wrote:
    ... Please suggest a select query / under query with using subroutines or functions/pkgs to get put out table.

    Why? If the most effective way to achieve the desired results is to use a function, why would you not use it?

    Here's a way, without all the features:

    SELECT     a.*
    FROM           source_table  a
    LEFT OUTER JOIN      source_table  b  ON   a.origin          = b.destination
                                          AND  a.destination       = b.origin
                          AND  a.miles          = b.miles
    WHERE   b.origin  > a.origin    -- Not b.origin > b.origin
    OR     b.origin  IS NULL
    ;
    

    If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.

    Published by: Frank Kulash, November 6, 2012 19:39
    Fixed WHERE after MLVrown clause (see below)

  • compose the query without using the query designer

    New on this BEEP 10.1.3.4.1 product,

    questions

    1. is there a way to compose a query without using query builder but still has a way to see the result of the query under the PIF?

    2. How is - a to compose a query prompt? I know that I can create parm after you create the data set, but at the stage of all data already call you query prompt as where employee id =? E_ID? or just not where clause


    Sorry if these questions are too rudimentary, but I did not see that what we have answered according to the user's guide.

    Thank you.


    WAN

    When you select the 'View' link, you should be able to see this option.

  • 'Function SQL Query return' using with Flash graphics

    I created a pl/sql function that returns a SQL query in a varchar2 of this form:

    Select the null link
    -value > < x value
    < value y of Series1 > series 1 label
    < value Series2 y > 2 series label
    < value of y Series3 > series 3 Label
    ...
    ...
    from tablea a
    Join tableb b
    On a.col = b.col
    order of < x value >

    If I call the function of a graphic Flash box series SQL with the Type of Source query "SQL query" value that returns the function like this:

    return functionname (to_date ('30-sep-2010, ' mon-dd-yyyy ""))

    It parses correctly and the page is saved; However, when I run the page I get no output - error messages or another indication of a problem.

    Now, if I call the function in a SQL client, capture the result of the query SQL using the dbms_output and paste that into the box graphic Flash series SQL - change the Source Type of SQL query query - and save the page it works fine when I run it and returns a chart series flash.

    Can anyone suggest either;

    1. what I might have missed or done wrong?
    2. a way to effectively diagnose the problem...

    I tried to use the debugger Apex - what is very nice, indeed - but it provides no information on what might be my problem. I tried to write my own my function debug messages using the apex_debug_message package - nothing...

    Thank you
    Eric

    Hi Eric,.

    Try to pull the source like this:

    begin
       return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'));
    end;
    

    This works very well for me, and if I take the begin-end and the final semicolon from the return statement I get the same behavior as you.

    He doesn't mention in aid of the source (only during the wizard if) this source type must be expressed in this way, but I agree, it would be useful that the tool would validate to this format meets it "Query SQL that returns the function" or give some sort of indication of the sentence. In any case, this should help you will again.

    Hope this helps,
    John

    If you find this information useful, please do not forget to mark the 'useful' or 'correct' post so that others benefit as well.

  • Is it necessary to use separate external hard drive or external hard drive new or freshly formatted for backup time machine.

    Is it necessary to use separate external hard drive or external hard drive new or freshly formatted for backup time machine.

    Both fresh and freshly, can use as a Time Machine backup HARD drive, although I personally prefer to use newly formatted disk.

  • How we force a query to use transparently a hint, even if the index is not given in the query as a query rewriting.

    How we force a query to use transparently a hint, even if the index is not given in the query as a query rewriting.

    For example:

    If the user runs a query select deptno, avg (sal) from emp group by deptno;

    We want the optimizer to use a hint of result_cache with this request, and it should be transparent to the user.

    Query should be rewritten to seamlessly

    Select / * + result_cache * / deptno, avg (sal)

    WCP

    Group of deptno;

    How can this feature we make? Please advice.

    I checked the possibility of SPM and contours, but it is not clear if this rewrite is possible here.

    Thank you and best regards,

    Vikas Krishna

    Surely dbms_advanced_rewrite is designed for this situation?

  • Need help to add totals and subtotals query that uses ROW_NUMBER OVER()

    Hi all

    We have the following query that is used in a report that generates a list of employees working a certain type of movement.
    The report also includes a column called RN that is used when the pagination for the report.
    What we are trying to do now is to add columns that indicate the total number of hours worked by the employee as well as gran total of hours of work for all employees in the report.

    We tried to add the columns last week and have been able to get the totals by using a group by clause. Only problem is that it has changed the order of the column of RN.
    The RN column must stay in numerical order, since we need to select and display the records for paging.

    Is it possible to get our totals without disturbing our paging RN column?

    BTW, thanks Frank for the addition of the UNPIVOT operator at our request. While other solutions worked, UNPIVOT has been the most effective.

    SEE below, the application and all the sql to create tables and test data.

    Thank you
    George
    SELECT *
      FROM (SELECT COUNT (*) OVER () record_count,
                   ROW_NUMBER ()
                   OVER (
                      ORDER BY
                         e.lname || ', ' || e.fname || ' - ' || e.initials DESC,
                         u.startdate DESC)
                      rn,
                   u.empid,
                   a.area,
                   e.lname,
                   e.fname,
                   e.initials,
                   u.startdate,
                   u.starttime,
                   u.endtime,
                   u.hours,
                   u.minutes
              FROM ((SELECT empid,
                            startpp + day_number - 1 startdate,
                            NULL starttime,
                            NULL endtime,
                            8 hours,
                            0 minutes
                       FROM    schedules s
                            JOIN
                               payperiods pp
                            ON pp.periodid = s.periodid 
    UNPIVOT ( v 
    FOR day_number IN (day1 AS 1
                      ,day2 AS 2
                      ,day3 AS 3
                      ,day4 AS 4
                      ,day5 AS 5
                      ,day6 AS 6
                      ,day7 AS 7
                      ,day8 AS 8
                      ,day9 AS 9
                      ,day10 AS 10
                      ,day11 AS 11
                      ,day12 AS 12
                      ,day13 AS 13
                      ,day14 AS 14)
             ) 
             WHERE SUBSTR (v, 1, 4) = 'SHFT' 
             UNION 
    SELECT l.empid,
           l.startdate,
           TO_CHAR (l.starttime, 'HH24:MI'),
           TO_CHAR (l.endtime, 'HH24:MI'),
           TRUNC (
                24
              * (CASE
                    WHEN l.starttime > l.endtime THEN l.endtime + 1 - l.starttime
                    ELSE l.endtime - l.starttime
                 END))
              hours,
           FLOOR (
                (  ( (l.endtime - l.starttime) * 24 * 60 * 60)
                 -   FLOOR ( ( (l.endtime - l.starttime) * 24 * 60 * 60) / 3600)
                   * 3600)
              / 60)
              minutes
      FROM leavereq l
     WHERE     UPPER (l.leavetype) = 'XYZShift'
           AND l.starttime IS NOT NULL
           AND approval = -1
           AND canceled = 0
    ) U) 
    JOIN employee e ON e.empid = u.empid 
    JOIN areas a ON a.areaid = e.areaid 
    WHERE a.configid = 1000 
    AND (startdate between to_date('4/7/2013','mm/dd/yyyy') and to_date('4/20/2013','mm/dd/yyyy')) 
    ORDER BY e.lname||', '||e.fname||' - '||e.initials DESC ,u.startdate DESC 
    ) WHERE rn BETWEEN 1 AND 75 
    order by rn;
    --------------------------------------------------------------------------------
    OUTPUT CURRENT
    RECORD_COUNT,RN,EMPID,AREA,LNAME,FNAME,INITIALS,STARTDATE,STARTTIME,ENDTIME,HOURS,MINUTES
    12,1,753948,TEST,Three,Employee,E3,4/17/2013,,,8,0
    12,2,753948,TEST,Three,Employee,E3,4/15/2013,,,8,0
    12,3,753948,TEST,Three,Employee,E3,4/12/2013,08:00,12:30,4,30
    12,4,753948,TEST,Three,Employee,E3,4/8/2013,,,8,0
    12,5,753940,TEST,Two,Employee,E2,4/12/2013,08:00,13:45,5,45
    12,6,753940,TEST,Two,Employee,E2,4/11/2013,,,8,0
    12,7,753940,TEST,Two,Employee,E2,4/9/2013,,,8,0
    12,8,753940,TEST,Two,Employee,E2,4/8/2013,,,8,0
    12,9,753938,TEST,One,Employee,O1,4/17/2013,,,8,0
    12,10,753938,TEST,One,Employee,O1,4/12/2013,08:00,14:20,6,20
    12,11,753938,TEST,One,Employee,O1,4/9/2013,,,8,0
    12,12,753938,TEST,One,Employee,O1,4/8/2013,,,8,0
    DESIREE OUTPUT
    RECORD_COUNT,RN,EMPID,AREA,LNAME,FNAME,INITIALS,STARTDATE,STARTTIME,ENDTIME,HOURS,MINUTES,EMPTOTAL,GRANTOTAL
    12,1                 ,753948,TEST,Three,Employee,E3       ,4/17/2013   ,               ,             ,8        ,0           ,28:30         ,88:35
    12                    ,2,753948,TEST,Three,Employee,E3       ,4/15/2013   ,               ,             ,8        ,0           ,28:30         ,88:35
    12                    ,3,753948,TEST,Three,Employee,E3       ,4/12/2013   ,08:00       ,12:30     ,4        ,30         ,28:30         ,88:35
    12                    ,4,753948,TEST,Three,Employee,E3       ,4/8/2013     ,               ,             ,8        ,0           ,28:30         ,88:35
    12                    ,5,753940,TEST,Two,Employee,E2         ,4/12/2013   ,08:00       ,13:45     ,5        ,45         ,29:45         ,88:35
    12                    ,6,753940,TEST,Two,Employee,E2         ,4/11/2013   ,               ,             ,8        ,0           ,29:45         ,88:35
    12                    ,7,753940,TEST,Two,Employee,E2         ,4/9/2013     ,               ,             ,8        ,0           ,29:45         ,88:35
    12                    ,8,753940,TEST,Two,Employee,E2         ,4/8/2013     ,               ,             ,8        ,0           ,29:45         ,88:35
    12                    ,9,753938,TEST,One,Employee,O1         ,4/17/2013   ,               ,             ,8        ,0           ,30:20         ,88:35
    12                    ,10,753938,TEST,One,Employee,O1       ,4/12/2013   ,08:00       ,14:20     ,6        ,20         ,30:20          ,88:35
    12                    ,11,753938,TEST,One,Employee,O1       ,4/9/2013     ,               ,             ,8        ,0           ,30:20          ,88:35
    12                    ,12,753938,TEST,One,Employee,O1       ,4/8/2013     ,               ,             ,8        ,0           ,30:20          ,88:35
    --------------------------------------------------------------------------------
    CREATE THE TABLE PROGRAMS
    (
    SCHEDULEID NUMBER (12) NOT NULL,
    EMPID NUMBER (12) NOT NULL,
    PERIODID VARCHAR2 (6 BYTE) NOT NULL,
    AREAID NUMBER (12) NOT NULL,
    DAY1 VARCHAR2 (50 BYTE),
    DAY 2 VARCHAR2 (50 BYTE).
    DAY 3 VARCHAR2 (50 BYTE).
    DAY4 VARCHAR2 (50 BYTE),
    DAY5 VARCHAR2 (50 BYTE),
    DAY6 VARCHAR2 (50 BYTE),
    DAY 7 VARCHAR2 (50 BYTE).
    JOUR8 VARCHAR2 (50 BYTE),
    DAY9 VARCHAR2 (50 BYTE),
    DAY10 VARCHAR2 (50 BYTE),
    DAY 11 VARCHAR2 (50 BYTE).
    DAY12 VARCHAR2 (50 BYTE),
    J13 VARCHAR2 (50 BYTE),
    DAY14 VARCHAR2 (50 BYTE),
    NOPTIND1 INTEGER DEFAULT 0,
    NOPTIND2 INTEGER DEFAULT 0,
    NOPTIND3 INTEGER DEFAULT 0,
    NOPTIND4 INTEGER DEFAULT 0,
    NOPTIND5 INTEGER DEFAULT 0,
    NOPTIND6 INTEGER DEFAULT 0,
    NOPTIND7 INTEGER DEFAULT 0,
    NOPTIND8 INTEGER DEFAULT 0,
    NOPTIND9 INTEGER DEFAULT 0,
    NOPTIND10 INTEGER DEFAULT 0,
    NOPTIND11 INTEGER DEFAULT 0,
    NOPTIND12 INTEGER DEFAULT 0,
    NOPTIND13 INTEGER DEFAULT 0,
    NOPTIND14 INTEGER DEFAULT 0
    );

    CREATE TABLE PAYPERIODS
    (
    PERIODID VARCHAR2 (6 BYTE) NOT NULL,
    DATE OF STARTPP,
    DATE OF ENDPP
    );

    CREATE TABLE LEAVEREQ
    (
    LEAVEREQID NUMBER (12) NOT NULL,
    EMPID NUMBER (12) NOT NULL,
    STARTDATE DATE,
    DATE STARTTIME,
    END DATE,
    LEAVETYPE VARCHAR2 (50 BYTE),
    DATE REQUESTED,
    ENTIRE DEFAULT 0 APPROVAL
    STOP CRITICAL INTEGER DEFAULT 0,
    CANCELLED INTEGER DEFAULT 0,
    ENTERBY VARCHAR2 (50 BYTE),
    APPROVEDBY VARCHAR2 (50 BYTE),
    DATE OF APPROVEDWHEN,
    REMARKS VARCHAR2 (4000 BYTE),
    APPINI VARCHAR2 (2 BYTE),
    NUMBER (12) ROUND.
    GOAL NUMBER (12).
    FMLA NUMBER (12) DEFAULT 0,
    LEAVEAREAID NUMBER (12).
    ARTICLE26 NUMBER (12) DEFAULT 0,
    ORG_LVREQID NUMBER (12)
    );

    CREATE TABLE EMPLOYEE
    (
    EMPID NUMBER (12) NOT NULL,
    AREAID NUMBER (12) NOT NULL,
    BIDAREA NUMBER (12) NOT NULL,
    LNAME VARCHAR2 (30 BYTE),
    FNAME VARCHAR2 (20 BYTE),
    MI VARCHAR2 (3 BYTE),
    CLASSIFICATION VARCHAR2 (10 BYTE),
    VARCHAR2 (2 BYTE) INITIALS,
    DATE OF EODXYZ,
    DATE OF EODNAT,
    VARCHAR2 (3 BYTE) STATUS,
    TURN VARCHAR2 (3 BYTE),
    RDO1 VARCHAR2 (6 BYTE),
    RDO2 VARCHAR2 (6 BYTE),
    TELEPHONE1 VARCHAR2 (14 BYTE),
    TELEPHONE2 VARCHAR2 (14 BYTE),
    REM VARCHAR2 (75 BYTE) DEFAULT 'NONE. '
    LAST4 NUMBER (12).
    SICKOK INTEGER,
    NOSIGNON INTEGER DEFAULT 0,
    TB VARCHAR2 (4 BYTE),
    SUP NUMBER (12).
    OM NUMBER (12).
    FMLA1 INTEGER,
    FMLA1SDATE DAY,
    FMLA1TYPE NUMBER (12).
    FMLA1HRSLEFT NUMBER (12).
    ADMINTEMP INTEGER,
    LEAVERESTRICT INTEGER,
    SLRESTRICT INTEGER,
    DATE OF SLRESDATE,
    DATE OF SLROCDATE,
    DEVSTATUS INTEGER DEFAULT 0,
    USERNAME VARCHAR2 (50 BYTE),
    PWORD VARCHAR2 (100 BYTE),
    PWORDCHG INTEGER,
    ULEVEL VARCHAR2 (50 BYTE),
    E-MAIL VARCHAR2 (50 BYTE),
    VARCHAR2 (50 BYTE) TEAM.
    ANN VARCHAR2 (50 BYTE),
    DDAY1 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY2 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY3 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY4 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY5 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY6 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY7 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY8 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY9 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY10 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY11 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY12 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY13 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    DDAY14 VARCHAR2 (50 BYTE) DEFAULT 'x ',.
    MOVEDATE DATE,
    OLDAREA VARCHAR2 (50 BYTE),
    GRPQA INTEGER,
    GRPTRNG INTEGER,
    LOGINFLAG INTEGER DEFAULT 0,
    NEWAREAID NUMBER (12).
    DATE OF EFFDATE,
    MODIFIED_BY VARCHAR2 (30 BYTE),
    DATE OF MODIFIED_DATE
    );

    CREATE TABLE SPACES
    (
    AREAID NUMBER (12) NOT NULL,
    CONFIGID NUMBER (12) NOT NULL,
    AREA VARCHAR2 (50 BYTE),
    ROLLUPALLOW INTEGER DEFAULT 0,
    SIGNONAREA INTEGER DEFAULT 0,
    OPDIS INTEGER DEFAULT 0,
    MODIFIED_BY VARCHAR2 (30 BYTE),
    DATE OF MODIFIED_DATE
    );
    --------------------------------------------------------------------------------
    Insert in CALENDARS
    (SCHEDULEID, EMPID, PERIODID, DAY1, AREAID
    DAY 2, DAY 3, DAY 4, DAY5 DAY6.
    DAY7 JOUR8, DAY9, DAY10, DAY 11,.
    J13, DAY14 DAY12, NOPTIND1, NOPTIND2,
    NOPTIND3, NOPTIND4, NOPTIND5, NOPTIND6, NOPTIND7,
    NOPTIND8, NOPTIND9, NOPTIND10, NOPTIND11, NOPTIND12,
    NOPTIND13, NOPTIND14)
    Values
    (3693744, 753738, '092013', 2003, 'X')
    "SHFT < 1530 > ', ' < 1530 SHFT > ', '1530', '1530', '1530',
    'X', 'X', '1530', '1530', 'SHIFT ',.
    "1530', '1530', 'X', 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    (0, 0);
    Insert in CALENDARS
    (SCHEDULEID, EMPID, PERIODID, DAY1, AREAID
    DAY 2, DAY 3, DAY 4, DAY5 DAY6.
    DAY7 JOUR8, DAY9, DAY10, DAY 11,.
    J13, DAY14 DAY12, NOPTIND1, NOPTIND2,
    NOPTIND3, NOPTIND4, NOPTIND5, NOPTIND6, NOPTIND7,
    NOPTIND8, NOPTIND9, NOPTIND10, NOPTIND11, NOPTIND12,
    NOPTIND13, NOPTIND14)
    Values
    (3693745, 753740, '092013', 2003, 'X')
    "SHFT < 1530 > ', ' < 1530 SHFT > ', '1530', 'SHIFT', '1530',
    'X', 'X', '1530', '1530', ' 1530',
    "1530', '1530', 'X', 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    (0, 0);
    Insert in CALENDARS
    (SCHEDULEID, EMPID, PERIODID, DAY1, AREAID
    DAY 2, DAY 3, DAY 4, DAY5 DAY6.
    DAY7 JOUR8, DAY9, DAY10, DAY 11,.
    J13, DAY14 DAY12, NOPTIND1, NOPTIND2,
    NOPTIND3, NOPTIND4, NOPTIND5, NOPTIND6, NOPTIND7,
    NOPTIND8, NOPTIND9, NOPTIND10, NOPTIND11, NOPTIND12,
    NOPTIND13, NOPTIND14)
    Values
    (3693746, 753748, '092013', 2003, 'X')
    "< 1530 SHFT > ', '1530', '1530', '1530', '1530',.
    'X', 'X', ' SHFT < 1530 > ', '1530', 'SHIFT ',.
    "1530', '1530', 'X', 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    (0, 0);

    COMMIT;

    Insert into PAYPERIODS
    (PERIODID, STARTPP)
    Values
    ('092013', TO_DATE (APRIL 7, 2013 00:00:00 ',' ' DD/MM/YYYY HH24:MI:SS));))
    COMMIT;

    Insert into LEAVEREQ
    (LEAVEREQID, EMPID, STARTDATE, STARTTIME, ENDTIME,
    LEAVETYPE, REQUEST, APPROVAL, REFUSED, ANNULLED,
    ENTERBY, APPROVEDBY, APPROVEDWHEN, ROUND, FMLA,.
    LEAVEAREAID, 26)
    Values
    (4265804, 753748, TO_DATE (12 APRIL 2013 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (APRIL 1, 2013 08:00 ',' ' HH24:MI:SS JJ/MM/AAAA), TO_DATE (APRIL 1, 2013 12:30 ',' MM/DD/YYYY HH24:MI:SS'),)
    'XYZShift', TO_DATE (8 April 2013 15:14:39 ',' ' the HH24: MI: SS DD/MM/YYYY), - 1, 0, 0,.
    'GH', 'GH', TO_DATE (8 APRIL 2013 15:18:52 ',' DD/MM/YYYY HH24:MI:SS'), 2, 0,.
    2003, 0);
    Insert into LEAVEREQ
    (LEAVEREQID, EMPID, STARTDATE, STARTTIME, ENDTIME,
    LEAVETYPE, REQUEST, APPROVAL, REFUSED, ANNULLED,
    ENTERBY, APPROVEDBY, APPROVEDWHEN, ROUND, FMLA,.
    LEAVEAREAID, 26)
    Values
    (4265805, 753740, TO_DATE (12 APRIL 2013 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (APRIL 1, 2013 08:00 ',' ' HH24:MI:SS JJ/MM/AAAA), TO_DATE (APRIL 1, 2013 13:45 ',' DD/MM/YYYY HH24:MI:SS'),)
    'XYZShift', TO_DATE (8 April 2013 15:16:04 ',' ' the HH24: MI: SS DD/MM/YYYY), - 1, 0, 0,.
    'GH', 'GH', TO_DATE (8 APRIL 2013 15:19:49 ',' DD/MM/YYYY HH24:MI:SS'), 2, 0,.
    2003, 0);
    Insert into LEAVEREQ
    (LEAVEREQID, EMPID, STARTDATE, STARTTIME, ENDTIME,
    LEAVETYPE, REQUEST, APPROVAL, REFUSED, ANNULLED,
    ENTERBY, APPROVEDBY, APPROVEDWHEN, ROUND, FMLA,.
    LEAVEAREAID, 26)
    Values
    (4265806, 753738, TO_DATE (12 APRIL 2013 00:00:00 ',' ' HH24:MI:SS JJ/MM/AAAA), TO_DATE (APRIL 1, 2013 08:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (APRIL 1, 2013 14:20 ',' DD/MM/YYYY HH24:MI:SS'),)
    'XYZShift', TO_DATE (8 April 2013 15:17:12 ',' ' the HH24: MI: SS DD/MM/YYYY), - 1, 0, 0,.
    'GH', 'GH', TO_DATE (8 APRIL 2013 15:26:55 ',' DD/MM/YYYY HH24:MI:SS'), 2, 0,.
    2003, 0);
    COMMIT;


    Insert EMPLOYEES
    (EMPID, AREAID, BIDAREA, LNAME, FNAME,
    CLASSIFICATION, INITIALS, EODXYZ, EODNAT, STATUS,
    RDO1, RDO2, REM, SICKOK, NOSIGNON,
    TB, SUP, OM, FMLA1, FMLA1SDATE,
    FMLA1HRSLEFT, ADMINTEMP, LEAVERESTRICT, SLRESTRICT, SLRESDATE,
    SLROCDATE, DEVSTATUS, ULEVEL, E-MAIL, TEAM,
    DDAY1, DDAY2, DDAY3, DDAY4, DDAY5,
    DDAY6, DDAY7, DDAY8, DDAY9, DDAY10,
    DDAY11, DDAY12, DDAY13, DDAY14, MOVEDATE,
    OLDAREA, GRPQA, GRPTRNG, LOGINFLAG MODIFIED_BY,
    MODIFIED_DATE)
    Values
    (753738, 2003, 2003, "one", "Employee",)
    '4_NON_BUE', 'E1', TO_DATE (1 JANUARY 2002 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (JANUARY 1, 2001 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'YES ', HE SAID.
    'SAM', 'SUN', 'NONE',-1, 0,
    'NONE', 749405, 749405, 0, TO_DATE (JANUARY 1, 2013 00:00:00 "," MM/DD/YYYY HH24:MI:SS'),
    8, 0, 0, 0, TO_DATE (JANUARY 1, 2013 00:00:00 "," MM/DD/YYYY HH24:MI:SS'),
    To_date (January 1, 2013 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 0, ' 1000', '[email protected]', '4',
    'X', '1530', '1530', ' 1530 ', ' 1530',
    "1530 ', 'X', 'X', '1530', ' 1530",
    "1530', '1530', '1530', 'X', TO_DATE (MARCH 18, 2013 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'),
    "1392 ', 0, 0, 0, '752910',
    TO_DATE('03/18/2013 12:10:04', 'MM/DD/YYYY HH24:MI:SS'));)
    COMMIT;

    Insert EMPLOYEES
    (EMPID, AREAID, BIDAREA, LNAME, FNAME,
    CLASSIFICATION, INITIALS, EODXYZ, EODNAT, STATUS,
    RDO1, RDO2, REM, SICKOK, NOSIGNON,
    TB, SUP, OM, FMLA1, FMLA1SDATE,
    FMLA1HRSLEFT, ADMINTEMP, LEAVERESTRICT, SLRESTRICT, SLRESDATE,
    SLROCDATE, DEVSTATUS, ULEVEL, E-MAIL, TEAM,
    DDAY1, DDAY2, DDAY3, DDAY4, DDAY5,
    DDAY6, DDAY7, DDAY8, DDAY9, DDAY10,
    DDAY11, DDAY12, DDAY13, DDAY14, MOVEDATE,
    OLDAREA, GRPQA, GRPTRNG, LOGINFLAG MODIFIED_BY,
    MODIFIED_DATE)
    Values
    (753740, 2003, 2003, "two", "Employee",)
    '4_NON_BUE', 'E2', TO_DATE (1 JANUARY 2002 00:00:00 ',' ' HH24:MI:SS JJ/MM/AAAA), TO_DATE (JANUARY 1, 2001 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'YES ', HE SAID.
    'SAM', 'SUN', 'NONE',-1, 0,
    'NONE', 749405, 749405, 0, TO_DATE (JANUARY 1, 2013 00:00:00 "," MM/DD/YYYY HH24:MI:SS'),
    8, 0, 0, 0, TO_DATE (JANUARY 1, 2013 00:00:00 "," MM/DD/YYYY HH24:MI:SS'),
    To_date (January 1, 2013 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 0, ' 1000', '[email protected]', '4',
    'X', '1530', '1530', ' 1530 ', ' 1530',
    "1530 ', 'X', 'X', '1530', ' 1530",
    "1530', '1530', '1530', 'X', TO_DATE (MARCH 18, 2013 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'),
    "1392 ', 0, 0, 0, '752910',
    TO_DATE('03/18/2013 12:10:04', 'MM/DD/YYYY HH24:MI:SS'));)
    COMMIT;

    Insert EMPLOYEES
    (EMPID, AREAID, BIDAREA, LNAME, FNAME,
    CLASSIFICATION, INITIALS, EODXYZ, EODNAT, STATUS,
    RDO1, RDO2, REM, SICKOK, NOSIGNON,
    TB, SUP, OM, FMLA1, FMLA1SDATE,
    FMLA1HRSLEFT, ADMINTEMP, LEAVERESTRICT, SLRESTRICT, SLRESDATE,
    SLROCDATE, DEVSTATUS, ULEVEL, E-MAIL, TEAM,
    DDAY1, DDAY2, DDAY3, DDAY4, DDAY5,
    DDAY6, DDAY7, DDAY8, DDAY9, DDAY10,
    DDAY11, DDAY12, DDAY13, DDAY14, MOVEDATE,
    OLDAREA, GRPQA, GRPTRNG, LOGINFLAG MODIFIED_BY,
    MODIFIED_DATE)
    Values
    (753748, 2003, 2003, "third", "Employee",)
    '4_NON_BUE', 'E3', TO_DATE (1 JANUARY 2002 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), TO_DATE (JANUARY 1, 2001 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'YES ', HE SAID.
    'SAM', 'SUN', 'NONE',-1, 0,
    'NONE', 749405, 749405, 0, TO_DATE (JANUARY 1, 2013 00:00:00 "," MM/DD/YYYY HH24:MI:SS'),
    8, 0, 0, 0, TO_DATE (JANUARY 1, 2013 00:00:00 "," MM/DD/YYYY HH24:MI:SS'),
    To_date (January 1, 2013 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 0, ' 1000', '[email protected]', '4',
    'X', '1530', '1530', ' 1530 ', ' 1530',
    "1530 ', 'X', 'X', '1530', ' 1530",
    "1530', '1530', '1530', 'X', TO_DATE (MARCH 18, 2013 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'),
    "1392 ', 0, 0, 0, '752910',
    TO_DATE('03/18/2013 12:10:04', 'MM/DD/YYYY HH24:MI:SS'));)
    COMMIT;

    Insert areas
    (AREAID CONFIGID, AREA, ROLLUPALLOW, SIGNONAREA,
    OPDIS)
    Values
    (2003, 1000, 'TEST',-1, 0,
    -1) ;
    COMMIT;
    ------------------------------------------------------------------------------------------------

    Published by: George Heller on April 8, 2013 13:32

    Published by: George Heller on April 8, 2013 14:35

    Published by: George Heller on April 8, 2013 14:49

    Hi, George.

    George Heller wrote:
    Hi all

    We have the following query that is used in a report that generates a list of employees working a certain type of movement.


    The report also includes a column called RN that is used when the pagination for the report.
    What we are trying to do now is to add columns that indicate the total number of hours worked by the employee as well as gran total of hours of work for all employees in the report.

    We tried to add the columns last week and have been able to get the totals by using a group by clause. Only problem is that it has changed the order of the column of RN.

    Please your postal code. It is very difficult for me to say what you're doing wrong when I don't know what you're doing.

    The RN column must stay in numerical order, since we need to select and display the records for paging.

    Is it possible to get our totals without disturbing our paging RN column?

    If you mix the aggregate functions and analytical in the query (sub-), the clause GROUP BY is applied and aggregate functions are calculated before the analytical functions are calculated. If you need to calculate the analytical functions first, calculate them in a subquery and make the GROUP BY and aggregate functions in a query Super.

    In this case, it may be simpler to use the analytical SUM, rather than the SUM function.

    SEE below, the application and all the sql to create tables and test data.

    Thank you; It is very useful.
    It would be even more useful if you included only the columns you really need, for the party, you don't already know how to do. For example, it seems that you need only to display 2 columns and area areaid to the table areas. ConfigId can be very important for this request, but you already know what to do with configid? It seems that the other columns of this table play no role in this issue and comes confusion.

    The average time for a first response on this forum is less than 10 minutes. I think people did flee seeing siuch a long message.

    ...
    TRUNC (
    24
    * (CASE
    WHEN l.starttime > l.endtime THEN l.endtime + 1 - l.starttime
    ELSE l.endtime - l.starttime
    END))
    hours,
    

    Why do you enter startime after endtime? If they are on separate days, record the days exactly.

    ...
    WHERE     UPPER (l.leavetype) = 'XYZShift'
    

    The expression to the left of the = sign is guaranteed not to contain all small letters, so it will never equal to "XYZShift".

    ...
    ORDER BY e.lname||', '||e.fname||' - '||e.initials DESC ,u.startdate DESC 
    

    A clause using ORDER BY in this subquery is just a waste of resources. (I'm not talking about analytical clauses ORDER BY;) I mean query ORDER BY clauses, like the one above).

    ) WHERE rn BETWEEN 1 AND 75
    order by rn;
    

    --------------------------------------------------------------------------------
    OUTPUT CURRENT

    RECORD_COUNT,RN,EMPID,AREA,LNAME,FNAME,INITIALS,STARTDATE,STARTTIME,ENDTIME,HOURS,MINUTES
    12,1,753948,TEST,Three,Employee,E3,4/17/2013,,,8,0
    12,2,753948,TEST,Three,Employee,E3,4/15/2013,,,8,0
    12,3,753948,TEST,Three,Employee,E3,4/12/2013,08:00,12:30,4,30
    12,4,753948,TEST,Three,Employee,E3,4/8/2013,,,8,0
    12,5,753940,TEST,Two,Employee,E2,4/12/2013,08:00,13:45,5,45
    12,6,753940,TEST,Two,Employee,E2,4/11/2013,,,8,0
    12,7,753940,TEST,Two,Employee,E2,4/9/2013,,,8,0
    12,8,753940,TEST,Two,Employee,E2,4/8/2013,,,8,0
    12,9,753938,TEST,One,Employee,O1,4/17/2013,,,8,0
    12,10,753938,TEST,One,Employee,O1,4/12/2013,08:00,14:20,6,20
    12,11,753938,TEST,One,Employee,O1,4/9/2013,,,8,0
    12,12,753938,TEST,One,Employee,O1,4/8/2013,,,8,0
    

    I get only 9 rows in the result set when I run your query. Please zip code that you actually run and the results you get in fact.

    DESIREE OUTPUT

    RECORD_COUNT,RN,EMPID,AREA,LNAME,FNAME,INITIALS,STARTDATE,STARTTIME,ENDTIME,HOURS,MINUTES,EMPTOTAL,GRANTOTAL
    12,1                 ,753948,TEST,Three,Employee,E3       ,4/17/2013   ,               ,             ,8        ,0           ,28:30         ,88:35
    12                    ,2,753948,TEST,Three,Employee,E3       ,4/15/2013   ,               ,             ,8        ,0           ,28:30         ,88:35
    12                    ,3,753948,TEST,Three,Employee,E3       ,4/12/2013   ,08:00       ,12:30     ,4        ,30         ,28:30         ,88:35
    12                    ,4,753948,TEST,Three,Employee,E3       ,4/8/2013     ,               ,             ,8        ,0           ,28:30         ,88:35
    

    Do you really want this order, with 'Tw' sorts before 'Th '?

    12                    ,5,753940,TEST,Two,Employee,E2         ,4/12/2013   ,08:00       ,13:45     ,5        ,45         ,29:45         ,88:35
    12                    ,6,753940,TEST,Two,Employee,E2         ,4/11/2013   ,               ,             ,8        ,0           ,29:45         ,88:35
    12                    ,7,753940,TEST,Two,Employee,E2         ,4/9/2013     ,               ,             ,8        ,0           ,29:45         ,88:35
    12                    ,8,753940,TEST,Two,Employee,E2         ,4/8/2013     ,               ,             ,8        ,0           ,29:45         ,88:35
    12                    ,9,753938,TEST,One,Employee,O1         ,4/17/2013   ,               ,             ,8        ,0           ,30:20         ,88:35
    12                    ,10,753938,TEST,One,Employee,O1       ,4/12/2013   ,08:00       ,14:20     ,6        ,20         ,30:20          ,88:35
    12                    ,11,753938,TEST,One,Employee,O1       ,4/9/2013     ,               ,             ,8        ,0           ,30:20          ,88:35
    12                    ,12,753938,TEST,One,Employee,O1       ,4/8/2013     ,               ,             ,8        ,0           ,30:20          ,88:35
    

    I think you want something like this:

    WITH   u      AS
    (
         SELECT  empid,
                    startpp + day_number - 1     AS startdate,
                    NULL                             AS starttime,
                    NULL                    AS endtime,
                    8                    AS hours,
                    0                    AS minutes
            FROM    schedules      s
                JOIN    payperiods     pp  ON   pp.periodid = s.periodid
         UNPIVOT ( v
              FOR day_number IN ( day1  AS  1
                                           , day2  AS  2
                                  , day3  AS  3
                                  , day4  AS  4
                                  , day5  AS  5
                                  , day6  AS  6
                                  , day7  AS  7
                                  , day8  AS  8
                                  , day9  AS  9
                                  , day10 AS 10
                                  , day11 AS 11
                                  , day12 AS 12
                                  , day13 AS 13
                                  , day14 AS 14
                          )
                   )
             WHERE   SUBSTR (v, 1, 4) = 'SHFT'
         UNION ALL
            SELECT  empid,
                     startdate,
                     TO_CHAR (starttime, 'HH24:MI'),
                     TO_CHAR (endtime,   'HH24:MI'),
                     TRUNC ( 24
                         * CASE
                                   WHEN starttime > endtime
                       THEN endtime + 1 - starttime
                             ELSE endtime - starttime
                            END
                    )               AS hours,
              MOD ( FLOOR ( (endtime - starttime)
                             * 24 * 60
                       )
                  , 60
                  )               AS minutes
            FROM    leavereq     l
          WHERE   UPPER (leavetype) = 'XYZSHIFT'
                AND     starttime          IS NOT NULL
                AND     approval         = -1
                AND     canceled         = 0
    )
    ,     join_results     AS
    (
         SELECT  COUNT (*) OVER () record_count,
                        ROW_NUMBER () OVER ( ORDER BY  e.lname          DESC
                                   ,            e.fname           DESC
                             ,            e.initials      DESC
                             ,         u.startdate     DESC
                             )        AS rn,
                    u.empid,
                    a.area,
                    e.lname,
                    e.fname,
                    e.initials,
                    u.startdate,
                    u.starttime,
                    u.endtime,
                    u.hours,
                    u.minutes,
              ( 60 * SUM (u.hours)   OVER (PARTITION BY  e.empid)
              )    + SUM (u.minutes) OVER (PARTITION BY  e.empid)     AS emp_minutes,
              ( 60 * SUM (u.hours)   OVER ()
              )    + SUM (u.minutes) OVER ()                    AS grand_minutes
            FROM     u
         JOIN     employee  e  ON   e.empid     = u.empid
         JOIN     areas        a  ON   a.areaid     = e.areaid
         WHERE     a.configid   = 1000
         AND     startdate    BETWEEN TO_DATE ('4/7/2013',  'mm/dd/yyyy')
                        AND     TO_DATE ('4/20/2013', 'mm/dd/yyyy')
    )
    SELECT       record_count,     rn,        empid,     area,    lname, fname,
           initials,     startdate, starttime, endtime, hours, minutes,
           TRUNC (emp_minutes   / 60) || ':'
                                      || TO_CHAR ( MOD (emp_minutes, 60)
                                       , 'FM00'
                                  )     AS emptotal,
           TRUNC (grand_minutes / 60) || ':'
                                      || TO_CHAR ( MOD (grand_minutes, 60)
                                       , 'FM00'
                                  )     AS grandtotal
    FROM       join_results
    WHERE       rn     BETWEEN      1
              AND     75
    ORDER BY  rn
    ;
    
  • Problem strange perf on hierarchical query

    Hi gurus,

    I have a problem of strange performance on a recursive query. By removing items one by one, I got the query begins to run very slowly when I add a GOLD in the CONNECT BY clause.

    The simplified query is the following:

     SELECT
          CONNECT_BY_ROOT( a.c_individu )
         ,a.c_individu
         ,SYS_CONNECT_BY_PATH( to_char(a.c_individu,'FM099999999'), ' ') path
         ,LEVEL
       FROM
         aaa a
       WHERE 
             CONNECT_BY_ISLEAF=1
         AND LEVEL > 1
       CONNECT BY a.c_individu < PRIOR a.c_individu
                          AND ( a.prenom_norm= PRIOR a.prenom_norm
                                AND a.d_naissance = PRIOR a.d_naissance
                                AND a.nom_famille_norm = PRIOR a.nom_famille_norm
                             /* OR 1=2 */ )
    

    AAA table contains 10,000 lines for my testing purposes and has an index on C_INDIVIDU.

    If I run this query with the 'OR 1 = 2' commented, it runs pretty fast:

    Elapsed: 00:00:00.10
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3286454403
    
    
    --------------------------------------------------------------------------------------
    | Id  | Operation                     | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT              |      | 10000 |   292K|   578   (1)| 00:00:07 |
    |*  1 |  FILTER                       |      |       |       |            |          |
    |*  2 |   CONNECT BY WITHOUT FILTERING|      |       |       |            |          |
    |   3 |    TABLE ACCESS FULL          | AAA  | 10000 |   292K|   578   (1)| 00:00:07 |
    --------------------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    
       1 - filter(CONNECT_BY_ISLEAF=1 AND LEVEL>1)
       2 - access("A"."PRENOM_NORM"=PRIOR "A"."PRENOM_NORM" AND
                  "A"."D_NAISSANCE"=PRIOR "A"."D_NAISSANCE" AND "A"."NOM_FAMILLE_NORM"=PRIOR
                  "A"."NOM_FAMILLE_NORM")
           filter("A"."C_INDIVIDU"<PRIOR "A"."C_INDIVIDU")
    

    As soon as I add the 'OR 1 = 2' statement, the query runs very slowly (19 seconds vs 0.1 seconds) and the execution plan is very different:

    Elapsed: 00:00:18.84
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3286454403
    
    
    --------------------------------------------------------------------------------------
    | Id  | Operation                     | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT              |      | 10000 |   292K|   578   (1)| 00:00:07 |
    |*  1 |  FILTER                       |      |       |       |            |          |
    |*  2 |   CONNECT BY WITHOUT FILTERING|      |       |       |            |          |
    |   3 |    TABLE ACCESS FULL          | AAA  | 10000 |   292K|   578   (1)| 00:00:07 |
    --------------------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    
       1 - filter(CONNECT_BY_ISLEAF=1 AND LEVEL>1)
       2 - access(INTERNAL_FUNCTION("A"."C_INDIVIDU")<INTERNAL_FUNCTION(PRIOR
                  "A"."C_INDIVIDU"))
           filter("A"."PRENOM_NORM"=PRIOR "A"."PRENOM_NORM" AND
                  "A"."D_NAISSANCE"=PRIOR "A"."D_NAISSANCE" AND "A"."NOM_FAMILLE_NORM"=PRIOR
                  "A"."NOM_FAMILLE_NORM" OR 1=2)
    

    Could someone explain to me why?

    Thank you!

    BANNER
    ------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    

    If the difference in the execution plan turning access predicates in the filter predicate will slow down performance as Oracle is looking more lines of analysis before filtering every time.

    The reason why he chose to do this is because he can not use your predicates connect more to make a hash map of your table based on the predicates. When just using pure equality filters, Oracle managed to the hash table on

    PRENOM_NORM, D_NAISSANCE, NOM_FAMILLE_NORM

    You need put somehow your new expression on a equal footing, I did the below but it starts from the principle that no line of aaa have nom_famille_norm = ' #', you may need to fiddle.

    SELECT
       CONNECT_BY_ROOT( a.c_individu )
      ,a.c_individu
      ,SYS_CONNECT_BY_PATH( to_char(a.c_individu,'FM099999999'), ' ') path
      ,LEVEL
    FROM
      aaa a
    WHERE
          CONNECT_BY_ISLEAF=1
      AND LEVEL > 1
    CONNECT BY a.c_individu < PRIOR a.c_individu
                       AND ( a.prenom_norm= PRIOR a.prenom_norm
                             AND a.d_naissance = PRIOR a.d_naissance
                             AND CASE WHEN 1=2 THEN '##' ELSE a.nom_famille_norm END = CASE WHEN 1=2 THEN '##' ELSE PRIOR a.nom_famille_norm  END
                           )
    /
    

    --------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    --------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT |      |     1.  1219.     2 (0) | 00:00:01 |
    |*  1 |  FILTER                       |      |       |       |            |          |
    |*  2 |   CONNECT TO WITHOUT FILTERING.      |       |       |            |          |
    |   3.    TABLE ACCESS FULL | AAA |     1.  1219.     2 (0) | 00:00:01 |
    --------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    1 - filter(CONNECT_BY_ISLEAF=1 AND LEVEL>1)
    2 - access("A".") PRENOM_NORM "="A"PRECONDITION." PRENOM_NORM' AND
    "A"." D_NAISSANCE "="A"PRECONDITION." D_NAISSANCE' AND 'A '. "NOM_FAMILLE_NORM '= BEFORE."
    "A"." NOM_FAMILLE_NORM')
    filter ("A". "C_INDIVIDU"

    Edit-

    Just to add that Oracle will use your index because you don't have any starting by conditions so the entire table must be completely digitized. Once the table has been fully scanned it will be in pga is probably still easier to read PGA rather than analysis of the index to find the following lines in the connection by.

  • IOM Setup integrated with OAM in HA using separate domains

    Must configure OAM and IOM in HA and integrated.

    Target architecture:
    1 is high availability. We have eight servers 2 for each of: level Web, OAM, OAM and OUD.
    2 OAM must be integrated with the IOM.

    3. we use two domains an OAM and another separate domain for IOM.

    4 using the version IAM 11.1.2.3

    We follow the high availability and guides 11.1.2.3 integration.
    On two servers with its domain, we have installed an OAM and IOM on two other servers with her owner field.

    We used the references:

    http://docs.Oracle.com/CD/E52734_01/OIM/IDMIG/OIM.htm#IDMIG32008 (Integration_guide)

    • 2.1.2 access Manager and Oracle Identity Manager integration to a single node topology

    You MUST set up the components of Oracle Identity Management in distinct areas WebLogic Server (split domain topology), as discussed in Section 1.2.1 "Integration of basic topology", otherwise, try to repair or upgrade a product can be blocked by a dependency of a component shared with another version. When you install the Oracle Identity Management components in a single WebLogic Server domain, there is a risk that you install the component (custom libraries, jars, utilities and plug-ins) in the area is perhaps not compatible with other components, resulting in problems through your domain.


    Oracle Identity Manager integration roadmap and Manager to access the section 2.1.3 Says nothing on utilization patterns separate db created by UCR and nothing on the store security DB.


    3.2.9.2 article before you set up the database of store security
    Note: Regardless of the number of domains in a logic Oracle Identity and Access Management 11 g Release 2 (11.1.2) deployment (a logical deployment is a collection of products Oracle Identity and Access Management running in one or more domains and use a single database to store product schemas), all areas share the same database to store security and use the same encryption key for domain.
    The store security database is created when the first domain is created, and each new domain created is then joined with the database already created security store.


    We have already installed and configured OAM in its own domain and now wants to configure the IOM in its own domain.

    For IOM configured in its own domain and use the same DB as OAM and configured the store DB to help security configureSecurityStore.py with the option to join - Mr. Successfully completed this but OAM had a NAP error message.


    My questions:

    1. install IOM, MUST create us the separate db schemas when you use the RCU for IOM of OAM?  If so, why? Since it is in contrast with the references I listed above.   AND the need to ensure that we can OAM integrated with IOM.

    2 If can be convinced that they must be separated from the patterns which for each of the OAM and IOM?  (I am aware IOM needs: MDS, OPSS, IOM, SOAINFRA, ORASDPM, BIPLATFORM.)  But necessarily list OAM)

    3 so we can share the same patterns or if need to use a separate diagram, how we create the database of store (AKA strategies store) security?  To help create or join mode?

    Keeping in mind that we must integrate OAM and IOM.

    Not sure if someone has managed to do this configuration.

    Thank you

    If you're feeling lucky, you can try to fix your updateBIPJMSSecurity.py and then continue, however, if you want to be sure that nothing else could get broken by following the demolition, start from the beginning.

  • explain query plan uses no unique index with where condition

    Hi all

    I use in the 10.2.0.5 oracle database Enterprise edition 64-bit on 64-bit windows server 2008.

    I'm following this tutorial on my own table

    Guide to understanding Oracle QUERY PLAN - 10 minutes

    my questions are below

    Analyze table LIB_CLASSIFICATIONS compute statistics;
    explain plan for  SELECT class_id  FROM lib_classifications WHERE class_no = '538' ;
    select * from table(dbms_xplan.display);
    

    the result is less than

    Hash value of plan: 3022072076

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

    | ID | Operation | Name                | Lines | Bytes | Cost (% CPU). Time |

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

    |   0 | SELECT STATEMENT |                     |     1.    10.     5 (0) | 00:00:01 |

    |*  1 |  TABLE ACCESS FULL | LIB_CLASSIFICATIONS |     1.    10.     5 (0) | 00:00:01 |

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

    Information of predicates (identified by the operation identity card):

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

    1 - filter ("CLASS_NO" = '538')

    DESC LIB_CLASSIFICATIONS

    Name of Type Null

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

    CLASS_ID NOT NULL NUMBER (10)

    CLASS_DESC VARCHAR2 (50)

    REMARKS VARCHAR2 (250)

    CLASS_NO VARCHAR2 (20)

    CLASS_TYPE VARCHAR2 (10)

    CREATE_USER VARCHAR2 (10)

    MODIFY_USER VARCHAR2 (10)

    CREATE_DATE DATE

    MODIFY_DATE DATE

    CLASS_CATEGORY_ID VARCHAR2 (10)

    class_id has a primary key.

    now when I remove the condition where the query, the result is lower;

    Analyze table LIB_CLASSIFICATIONS compute statistics;
    explain plan for  SELECT class_id  FROM lib_classifications ;
    select * from table(dbms_xplan.display);
    

    the result is less than

    Hash value of plan: 262704430

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

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

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

    |   0 | SELECT STATEMENT |             |  1558.  6232.     2 (0) | 00:00:01 |

    |   1.  FULL RESTRICTED INDEX SCAN FAST | SYS_C005653 |  1558.  6232.     2 (0) | 00:00:01 |

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

    now it's using indexes with INDEX FAST FULL SCAN.

    I need the index using the WHERE condition as well.

    How to do this?

    Thank you.

    you have indexes on the column class_id not on class_no column how u would expect index to use when there is no index on the column class_no

  • Tools.syncTime query parameter using PowerCLI

    Hey,.

    I have a vCenter 5.5 full of virtual machines that I need to test compliance with KB1189 - disabling time synchronization

    Using Get-AdvancedSetting I can test and get results for all parameters except 'tools.syncTime '.  Is there a way to query this setting?

    Thank you

    There is indeed no need to perform a Get-view extra, you can do

    Get - VM | Select Name,@{N='TimeSync'; E={$_. ExtensionData.Config.Tools.syncTimeWithHost}}

  • Query not using Full Scan Index

    Hello world

    I'm on 11.2.0.3.0 AIX 6.1.

    There is a query such as:

    Select: sys_b_0 | Count (distinct (column_name)) table;

    that goes for the analysis full table. The column was values separate only 104 with not NULL values. To save memory buffer gets, I created an index on the table with the column used in the query (i.e. whose distinct values are recovered).

    The problem is that even after the creation of indexes and force the flag index that it does not use the full scan of the index. The provided indication is correct in syntax and was the only clue in the query, so there is no question of conflicts with others.

    Can anyone suggest me what I might be missing?

    Thank you

    It seems to me that if print_branch_code is defined as nullable in the table. If this is the case, the optimizer goes for a sweep of index, even if there is no real NULL values

  • Need help with a query complex for the production database

    Hello again,

    I need your help once again, for a query how to show me how long each stage of production is by order.
    See examples of data and what I expect.
    Thank you all for your help.

    We use Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Here the example data tables:
    CREATE      TABLE      TABLE_2
       
    (     "ORDER_NR"      VARCHAR2 (12)
    ,      "PRIORITY"      VARCHAR2 (2)
    ,      "WO_STEP"      VARCHAR2 (1)
    ,      "STEP_DATE"      DATE
    );
    
    CREATE      TABLE      TABLE_1
    (     "ORDER_NR"           VARCHAR2     (12) PRIMARY KEY
    ,      "PRIORITY"           VARCHAR2      (2)
    ,      "CREATE_DATE"      DATE
    ,     "ACT_STEP"          VARCHAR2     (2)
    ,     "STEP_DATE"          DATE
    ,     "EMPLOYEE"          VARCHAR2     (5)
    ,     "DESCRIPTION"     VARCHAR2     (20)
    );
    
    INSERT      INTO      TABLE_1      (ORDER_NR,               PRIORITY,      CREATE_DATE,                                                        ACT_STEP,     STEP_DATE,                                                            EMPLOYEE,     DESCRIPTION) 
                        VALUES           ('1KKA1T205634',     '12',          TO_DATE('10-FEB-13 10:00:00','DD-MON-RR HH24:MI:SS'),     'U',          TO_DATE('28-FEB-13 12:00:00','DD-MON-RR HH24:MI:SS'),     'W0010',     'CLEAN HOUSE');
    INSERT      INTO      TABLE_1      (ORDER_NR,               PRIORITY,     CREATE_DATE,                                                        ACT_STEP,     STEP_DATE,                                                            EMPLOYEE,     DESCRIPTION)
                        VALUES           ('1KKA1Z300612',     '12',          TO_DATE('08-FEB-13 14:00:00','DD-MON-RR HH24:MI:SS'),     'F',          TO_DATE('20-FEB-13 16:00:00','DD-MON-RR HH24:MI:SS'),     'K0052',     'REPAIR CAR');
    
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'A',          TO_DATE('12-FEB-13 13:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          '5',          TO_DATE('13-FEB-13 09:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'K',          TO_DATE('13-FEB-13 10:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          '5',          TO_DATE('13-FEB-13 11:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'K',          TO_DATE('13-FEB-13 12:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          '5',          TO_DATE('13-FEB-13 16:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'C',          TO_DATE('14-FEB-13 08:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'B',          TO_DATE('14-FEB-13 10:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'E',          TO_DATE('18-FEB-13 13:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'F',          TO_DATE('20-FEB-13 16:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'S',          TO_DATE('21-FEB-13 08:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'R',          TO_DATE('21-FEB-13 09:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1T205634',     '12',          'U',          TO_DATE('28-FEB-13 12:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'A',          TO_DATE('12-FEB-13 13:52:42','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          '5',          TO_DATE('13-FEB-13 09:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'K',          TO_DATE('13-FEB-13 10:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          '5',          TO_DATE('13-FEB-13 11:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'K',          TO_DATE('13-FEB-13 12:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          '5',          TO_DATE('13-FEB-13 16:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'C',          TO_DATE('14-FEB-13 08:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'B',          TO_DATE('14-FEB-13 10:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'E',          TO_DATE('18-FEB-13 13:00:00','DD-MON-RR HH24:MI:SS'));
    INSERT     INTO      TABLE_2      (ORDER_NR,               PRIORITY,     WO_STEP,     STEP_DATE)
                        VALUES           ('1KKA1Z300612',     '12',          'F',          TO_DATE('20-FEB-13 16:00:00','DD-MON-RR HH24:MI:SS'));
    COMMIT;
    And here's what I expect of my request:
    SYSDATE     28.Feb.13 14:00                                                                                     
                                                                                              
    ORDER_NR     PRIORITYCREATE_DATE     STATUS     STATUS_DATE     DESCRIPTION     AGE_1     AGE_2     WAITNG     STEP_A     STEP_B     STEP_C     STEP_5     STEP_K     STEP_E     STEP_F     STEP_S     STEP_R     
    1KKA1T205634     12     10.Feb.13 10:00     U     28.Feb.13 12:00     CLEAN HOUSE     18,083     8,833     2,125     0,833     4,125     0,083     0,750     0,208     2,125     0,666     0,042     7,125     
    1KKA1Z300612     12     08.Feb.13 14:00     F     20.Feb.13 16:00     REPAIR CAR     20,000     16,042     2,125     0,833     4,125     0,083     0,750     0,208     2,125     0,666          
    And now the explanation for the result of the query:
    The AGE_1 is the difference in days between the "CREATE_DATE" and if EXSIST L'ETAPE 'U' then STEP_DATE or if the STEP 'U' is not found in TABLE_2 then it should show the difference in days between the "CREATE_DATE' and the 'SYSDATE.
    The AGE_2 is the difference in days between the STEP "A" STEP_DATE and IF EXSIST L'ETAPE 'R' then STEP_DATE or if the STEP 'R' is not in TABLE_2 then it should show the difference in days between the "CREATE_DATE' and the 'SYSDATE.
    The EXPECTATION is the difference in days between CREATE_DATE and STEP 'A' STEP_DATE
    The following columns indicate the days, how long the ORDER_NR remains in these TIMES, if an ORDER_NR comes in the same STEP should be calculated together more than once.
    If the ORDER_NR jump a step, it should show a zero in the specific field.

    I hope that my explanation is good enough, my English skills are far from good.

    Thank you for all your help.

    Hosts Reinhard W.

    Solomon Yakobson says:
    Just add the amounts:

    In fact, you could edit all CASES:

    with t2 as (
                select  t.*,
                        lead(step_date) over(partition by order_nr order by step_date) next_step_date
                  from  table_2 t
               )
    select  t1.*,
            nvl(
                max(
                    case t2.wo_step
                      when 'U' then t2.step_date
                    end
                   ),
               sysdate
              ) - t1.create_date age_1,
            nvl(
                max(
                    case t2.wo_step
                      when 'R' then t2.step_date
                    end
                   ),
               sysdate
              ) - t1.create_date age_2,
            sum(
                case
                  when t2.wo_step in ('B','5') then t2.next_step_date - t2.step_date
                end
               ) step_b_5,
            sum(
                case t2.wo_step
                  when 'C' then t2.next_step_date - t2.step_date
                end
               ) step_c,
            sum(
                case t2.wo_step
                  when 'K' then t2.next_step_date - t2.step_date
                end
               ) step_k,
            sum(
                case t2.wo_step
                  when 'E' then t2.next_step_date - t2.step_date
                end
               ) step_e,
            sum(
                case t2.wo_step
                  when 'F' then t2.next_step_date - t2.step_date
                end
               ) step_f,
            sum(
                case t2.wo_step
                  when 'S' then t2.next_step_date - t2.step_date
                end
               ) step_s,
            sum(
                case t2.wo_step
                  when 'R' then t2.next_step_date - t2.step_date
                end
               ) step_r
      from  table_1 t1,
            t2
      where t2.order_nr = t1.order_nr
      group by t1.order_nr,
               t1.priority,
               t1.create_date,
               t1.act_step,
               t1.step_date,
               t1.employee,
               t1.description
    /
    
    ORDER_NR     PR CREATE_DA AC STEP_DATE EMPLO DESCRIPTION      AGE_1      AGE_2   STEP_B_5     STEP_C  STEP_K     STEP_E     STEP_F        STEP_S     STEP_R
    ------------ -- --------- -- --------- ----- ----------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
    1KKA1T205634 12 10-FEB-13 U  28-FEB-13 W0010 CLEAN HOUSE 18.0833333 10.9583333      4.875 .083333333 .208333333      2.125 .666666667 .041666667      7.125
    1KKA1Z300612 12 08-FEB-13 F  20-FEB-13 K0052 REPAIR CAR   44.252338  44.252338      4.875 .083333333 .208333333      2.125
    
    SQL>
    

    SY.

  • query not using the index for some user

    Hello

    I have a query that is running in less than a second for sys, system, or schema owner. However, another user (test_user) take 30 seconds to run the same query.

    I certainly dba and privileges identical to test_user as schmea_user, but the result is the same.

    I checked

    Select * from V$ SYS_OPTIMIZER_ENV;

    Both are the same for both users.

    I have check the plan to explain to both users. I noticed that for sys/system/schema_owner, the query uses an index, but not the test_user.

    All have experience the issue where a user uses an index, but not the other?

    Thank you for any assistance.

    Thank you for the display of formatting output, this output is much easier to read.

    One of the first things you notice about the execution plans that is for the owner non-schema "SQL_ID, 0wcs85uywn72m, number of children 1" appears in the output of DBMS_XPLAN, while "SQL_ID 0wcs85uywn72m, child number 0" (the same SQL_ID but a different number of child) appears for the schema owner. "" Whereas the SQL_ID is the same, which indicates that the client requires exactly the same SQL statement, so it's a good start.

    Then, note that in the predicate for the nonschema owner information section the following appears (sometimes with the order of the two conditions switched in position) as a condition placed on each table that is available in the schema:

    filter(("SEAL_FLAG" IS NULL OR "SEAL_FLAG"'Y'))
    

    The above suggests the presence of the virtual private database (or a superset of private database virtual) generated the predicates. You should be able to confirm that this is the case by querying V$ VPD_POLICY using the SQL_ID which was displayed in the DBMS_XPLAN output:

    SELECT
      *
    FROM
      V$VPD_POLICY
    WHERE
      SQL_ID='0wcs85uywn72m';
    

    As a test, I made a few minor adjustments to the example on this page:
    http://Antognini.ch/2011/09/optimizer_secure_view_merging-and-VPD/
    I changed the name of T to T12 and TESTUSER table specified for the schema names. I then created the function S of this page as follows:

    CREATE OR REPLACE FUNCTION s (schema IN VARCHAR2, tab IN VARCHAR2) RETURN VARCHAR2 AS
    BEGIN
      RETURN 'ID < 10';
    END;
    /
    

    I then added a couple of lines in the T12 test table:

    INSERT INTO T12 VALUES (1,1,NULL);
    INSERT INTO T12 VALUES (4,1,NULL);
    INSERT INTO T12 VALUES (10,1,NULL);
    INSERT INTO T12 VALUES (12,1,NULL);
    
    COMMIT;
    

    With an active 10053 trace, I executed the following SQL statement:

    SELECT id, pad
      FROM t12
      WHERE
      spy(id, pad) = 1
    

    The SQL_ID (in my case, found in the 10053 trace file) was 6hqw5p9d8g8wf, so I checked V$ VPD_POLICY to this SQL_ID:

    SELECT
      *
    FROM
      V$VPD_POLICY
    WHERE
      SQL_ID='6hqw5p9d8g8wf';
    
    ADDRESS          PARADDR            SQL_HASH SQL_ID        CHILD_NUMBER OBJECT_OWNER OBJECT_NAME                    POLICY_GROUP                   POLICY                 POLICY_FUNCTION_OWNER          PREDICATE
    ---------------- ---------------- ---------- ------------- ------------ ------------ ------------------------------ ------------------------------ ---------------------- ------------------------------ ------------------------------------------------------------------------------------
    000007FFB7701608 000007FFB7743350 1518838670 6hqw5p9d8g8wf            0 TESTUSER     T12                            SYS_DEFAULT                    T_SEC                  TESTUSER                       ID < 10
    

    As noted above, the VPD test function named S added the predicate "ID".< 10"="" to="" the="" sql="">

    There are not many clues in the 10053 trace file in my test VPD generated additional predicates. Trace the following was found shortly after the beginning of the file (this is the SQL statement initially presented):

    ----- Current SQL Statement for this session (sql_id=6hqw5p9d8g8wf) -----
    SELECT id, pad
      FROM t12
      WHERE
      spy(id, pad) = 1
    

    I searched then down in the trace for final after changes query file (to be noted that this sentence could be slightly different in different versions of database Oracle). That's what I found:

    Final query after transformations: ******* UNPARSED QUERY IS *******
    SELECT "T12"."ID" "ID","T12"."PAD" "PAD" FROM "TESTUSER"."T12" "T12" WHERE "TESTUSER"."SPY"("T12"."ID","T12"."PAD")=1 AND "T12"."ID"<10
    kkoqbc: optimizing query block SEL$F5BB74E1 (#0)
    

    Note that the final query after transformation shows how the final version of the query that has been rewritten by the query optimizer before the SQL statement has been executed and this version of the query includes AND "T12". "" IDENTITY CARD ".<10. if="" i="" was="" attempting="" to="" determine="" how="" that=""><10 predicate="" was="" added="" to="" the="" sql="" statement,="" i="" would="" start="" at="" the="" "current="" sql="" statement="" for"="" line="" in="" the="" trace="" file="" and="" search="" down="" the="" trace="" file="" for=""><10* -="" in="" this="" case,="" the="" following="" is="" what="" i="" found="" as="" the="" first="" search="" result,="" very="" close="" to="" the="" "current="" sql="" statement="" for"="" line="" in="" the="" trace="">

    **************************
    Predicate Move-Around (PM)
    **************************
    PM:     PM bypassed: Outer query contains no views.
    PM:     PM bypassed: Outer query contains no views.
    query block SEL$F5BB74E1 (#0) unchanged
    FPD: Considering simple filter push in query block SEL$F5BB74E1 (#0)
    "TESTUSER"."SPY"("T12"."ID","T12"."PAD")=1 AND "T12"."ID"<10
    try to generate transitive predicate from check constraints for query block SEL$F5BB74E1 (#0)
    finally: "TESTUSER"."SPY"("T12"."ID","T12"."PAD")=1 AND "T12"."ID"<10
    

    As can be seen from the above (because the predicate again appeared before and after the line containing the word "Finally: '), the AND"T12 ". "" IDENTITY CARD ".<10 predicate="" was="" already="" added="" to="" the="" original="" sql="" statement="" by="" the="" time="" the="" predicate="" move-around="" section="" of="" the="" trace="" file="" was="" written,="" and="" that="" is="" the="" first="" mention="" of=""><10 in="" the="" trace="" file.="" in="" your="" case,="" you="" would="" search="" the="" 10053="" trace="" file="">

    "SEAL_FLAG" IS NULL
    

    If V$ VPD_POLICY revealed that there are virtual private database (VPD) generated predicates applied to the SQL statement, take a look at the following article in the Oracle documentation library:
    http://docs.Oracle.com/CD/B28359_01/network.111/B28531/VPD.htm

    This article lists the different points of view, who can be interviewed to learn more about the VPD rules which are in force in the schema. For example, with my SPV test:

    SELECT
      *
    FROM
      ALL_POLICIES;
    
    OBJECT_OWNER                   OBJECT_NAME                    POLICY_GROUP                  POLICY_NAME                    PF_OWNER                       PACKAGE                       FUNCTION                       SEL INS UPD DEL IDX CHK ENA STA POLICY_TYPE              LON
    ------------------------------ ------------------------------ ----------------------------- ------------------------------ ------------------------------ ----------------------------- ------------------------------ --- --- --- --- --- --- --- --- ------------------------ ---
    TESTUSER                       T12                            SYS_DEFAULT                   T_SEC                          TESTUSER                       S                                                            YES YES YES YES NO  NO  YES NO  DYNAMIC                  NO
    

    He knows performance issues related to the use of VPD, some of which are Oracle Database version-dependent, and some have been fixed in recent versions. Take a look at the following articles if you have access to My Oracle Support:
    MetaLink (MOS) Doc ID 728292.1 ' known performance problems when you use transparent encryption data and indexes on the encrypted columns.
    MetaLink (MOS) Doc ID 967042.1 "How to investigate Query Performance regressions Caused by VPD (FGAC) predicates?"

    You might find working through the second of the above that the problem is caused by a bug in database Oracle.

    On a side note. Execution plans you have published include the 0 value in the column starts many of the operations in the execution plan. 0 indicates that the operation never actually executed. A 0 is included in the column starts on the line that includes the FULL ACCESS of TABLE of PEOPLE_TRANSACTIONS at least to the OPC. Value 123, a full table of PEOPLE_TRANSACTIONS table scan PROPERTY_CONTAINER_ID was not actually performed.

    Charles Hooper
    http://hoopercharles.WordPress.com/
    IT Manager/Oracle DBA
    K & M-making Machine, Inc.

  • using separate in this way

    Hi all

    I searched and google it but still not unfortunately translate

    I need to make something like this below
    select distinct(t.id, t.place)
    from table_one
    I know that I'm not only the use of separate, but what syntax can I use in a way instead. This idea is roughly

    I get the following data below
     
    
    ID   Place
    A    Berlin
    A    Berlin
    A    Berlin
    B    Berlin
    B    Berlin
    C    London
    C    New york
    and I'm counting the results based on the fact that we have no duplicates (ID and location being the same), so published data. The County
    should be  4, because A Berlin is 1 count
                                   B  Berlin is another Count
                                   C  london is another count
                                    C New York is another count
    Any help is appreciated.

    Published by: user13328581 on November 14, 2010 13:46

    What Solomon post should work for you, well, otherwise you will need to show us exactly what you did (copy/paste of SQLPLUS) using a few samples and explain the "why".

    Here's my "it works (based on your explanations of what you need). First of all, using approach of Solomon and then approach "more intuitive.

    TUBBY_TUBBZ?
    with t as (
               select 'A' id,'Berlin' place, sysdate as Create_date from dual union all
               select 'A','Berlin', sysdate+1 from dual union all
               select 'A','Berlin', sysdate+2 from dual union all
               select 'B','Berlin', sysdate+3 from dual union all
               select 'B','Berlin', sysdate+4 from dual union all
               select 'C','London', sysdate+5 from dual union all
               select 'C','New york', sysdate+6 from dual
              )
    select  count(count(*))
      from  t
      group by id,
               place
     14  /
    
    COUNT(COUNT(*))
    ---------------
               4
    
    1 row selected.
    
    with t as (
               select 'A' id,'Berlin' place, sysdate as Create_date from dual union all
               select 'A','Berlin', sysdate+1 from dual union all
               select 'A','Berlin', sysdate+2 from dual union all
               select 'B','Berlin', sysdate+3 from dual union all
               select 'B','Berlin', sysdate+4 from dual union all
               select 'C','London', sysdate+5 from dual union all
               select 'C','New york', sysdate+6 from dual
              )
    select count(*)
    from
    (
      select
        distinct
          id,
          place
      from
        t
    )
     20  /
    
      COUNT(*)
    ----------
          4
    
    1 row selected.
    
    TUBBY_TUBBZ?
    

Maybe you are looking for