Fine tune Query

Hi , I would like to ask the expert here..how could i fine tune the below query..now it return data within 60 seconds. however my client require the data should return <5 second
SELECT DECODE (CURR.START_DATE, '', PREV.START_DATE, CURR.START_DATE) START_DATE,
DECODE (CURR.START_HOUR, '', PREV.START_HOUR, CURR.START_HOUR) START_HOUR,
DECODE (CURR.IN_PARTNER, '', PREV.IN_PARTNER, CURR.IN_PARTNER) IN_PARTNER,
DECODE (CURR.OUT_PARTNER, '', PREV.OUT_PARTNER, CURR.OUT_PARTNER) OUT_PARTNER,
DECODE (CURR.SUBSCRIBER_TYPE, '', PREV.SUBSCRIBER_TYPE, CURR.SUBSCRIBER_TYPE) SUBSCRIBER_TYPE,
DECODE (CURR.TRAFFIC_TYPE, '', PREV.TRAFFIC_TYPE, CURR.TRAFFIC_TYPE) TRAFFIC_TYPE,
DECODE (CURR.EVENT_TYPE, '', PREV.EVENT_TYPE, CURR.EVENT_TYPE) EVENT_TYPE,
DECODE (CURR.INTERVAL_PERIOD, '', PREV.INTERVAL_PERIOD, CURR.INTERVAL_PERIOD) INTERVAL_PERIOD,
--DECODE (CURR.THRESHOLD, '', PREV.THRESHOLD, CURR.THRESHOLD) THRESHOLD,
DECODE (CURR.CALLED_NO_GRP, '', PREV.CALLED_NO_GRP, CURR.CALLED_NO_GRP) CALLED_NO_GRP,
SUM (DECODE (CURR.EVENT_COUNT, '', 0, CURR.EVENT_COUNT)) EVENT_COUNT,
--SUM (DECODE (CURR.EVENT_DURATION, '', 0, CURR.EVENT_DURATION)) EVENT_DURATION,
--SUM (DECODE (CURR.DATA_VOLUME, '', 0, CURR.DATA_VOLUME)) DATA_VOLUME,
--AVG (DECODE (CURR.AVERAGE_DURATION, '', 0, CURR.AVERAGE_DURATION)) AVERAGE_DURATION,
SUM (DECODE (PREV.EVENT_COUNT_PREV, '', 0, PREV.EVENT_COUNT_PREV)) EVENT_COUNT_PREV,
--SUM ( DECODE (PREV.EVENT_DURATION_PREV, '', 0, PREV.EVENT_DURATION_PREV)) EVENT_DURATION_PREV,
--SUM (DECODE (PREV.DATA_VOLUME_PREV, '', 0, PREV.DATA_VOLUME_PREV)) DATA_VOLUME_PREV,
--AVG ( DECODE (PREV.AVERAGE_DURATION_PREV, '', 0, PREV.AVERAGE_DURATION_PREV)) AVERAGE_DURATION_PREV,
ABS ( SUM (DECODE (CURR.EVENT_COUNT, '', 0, CURR.EVENT_COUNT)) - SUM ( DECODE (PREV.EVENT_COUNT_PREV, '', 0, PREV.EVENT_COUNT_PREV))) EVENT_COUNT_DIFF
FROM ------------------------------- CURR
(SELECT START_DATE,
START_HOUR,
IN_PARTNER,
OUT_PARTNER,
SUBSCRIBER_TYPE,
TRAFFIC_TYPE,
EVENT_TYPE,
--rd_thr.param_value THRESHOLD,
rd.param_value INTERVAL_PERIOD,
CALLED_NO_GRP,
--SUM (DATA_VOLUME)                                                                                                                       AS DATA_VOLUME,
--SUM (EVENT_DURATION)                                                                                                                    AS EVENT_DURATION,
--DECODE ( SUM (NVL (EVENT_COUNT / 1000000, 0)), 0, 0, ROUND ( SUM (EVENT_DURATION / 1000000) / SUM (NVL (EVENT_COUNT / 1000000, 0)), 2)) AS AVERAGE_DURATION,
SUM (EVENT_COUNT) AS EVENT_COUNT
FROM MSC_OUT_AGG,
raid_t_parameters rd,
raid_t_parameters rd_min,
raid_t_parameters rd_max,
raid_t_parameters rd_thr
WHERE TRUNC (SYSDATE - TO_DATE (START_DATE, 'YYYYMMDD')) <= rd_min.param_value
AND rd_min.param_id = 'histMD_IN_MSC'
AND rd_min.param_id2 = 'DASHBOARD_THRESHOLD_MIN'
AND rd.param_id = 'histMD_IN_MSC'
AND rd.param_id2 = 'INTERVAL_PERIOD'
AND rd_max.param_id = 'histMD_IN_MSC'
AND rd_max.param_id2 = 'DASHBOARD_THRESHOLD_MAX'
AND rd_thr.param_id = 'histMD_IN_MSC'
AND rd_thr.param_id2 = 'PER_THRESHOLD_W'
AND TO_DATE (START_DATE, 'YYYYMMDD') < SYSDATE - rd_max.param_value
AND SOURCE = 'MD_IN_MSC_HUA'
GROUP BY START_DATE,
START_HOUR,
IN_PARTNER,
OUT_PARTNER,
SUBSCRIBER_TYPE,
TRAFFIC_TYPE,
EVENT_TYPE,
rd.param_value,
CALLED_NO_GRP,
rd_thr.param_value
) CURR
FULL OUTER JOIN
---------------------------------- PREV --------------------------
SELECT TO_CHAR ( TRUNC ( rd.param_value + TO_DATE (START_DATE, 'YYYYMMDD')), 'YYYYMMDD') START_DATE,
START_HOUR,
IN_PARTNER,
OUT_PARTNER,
SUBSCRIBER_TYPE,
TRAFFIC_TYPE,
EVENT_TYPE,
rd.param_value INTERVAL_PERIOD,
CALLED_NO_GRP,
--rd_thr.param_value THRESHOLD,
SUM (EVENT_COUNT) AS EVENT_COUNT_PREV
--SUM (EVENT_DURATION)                                                                                                                    AS EVENT_DURATION_PREV,
--DECODE ( SUM (NVL (EVENT_COUNT / 1000000, 0)), 0, 0, ROUND ( SUM (EVENT_DURATION / 1000000) / SUM (NVL (EVENT_COUNT / 1000000, 0)), 2)) AS AVERAGE_DURATION_PREV,
--SUM (DATA_VOLUME)                                                                                                                       AS DATA_VOLUME_PREV
FROM MSC_OUT_AGG,
raid_t_parameters rd,
raid_t_parameters rd_min,
raid_t_parameters rd_max,
raid_t_parameters rd_thr
WHERE TRUNC ( SYSDATE - TRUNC ( rd.param_value + TO_DATE (START_DATE, 'YYYYMMDD'))) <= rd_min.param_value
AND rd.param_id = 'histMD_IN_MSC'
AND rd.param_id2 = 'INTERVAL_PERIOD'
AND rd_min.param_id = 'histMD_IN_MSC'
AND rd_min.param_id2 = 'DASHBOARD_THRESHOLD_MIN'
AND rd_max.param_id = 'histMD_IN_MSC'
AND rd_max.param_id2 = 'DASHBOARD_THRESHOLD_MAX'
AND rd_thr.param_id = 'histMD_IN_MSC'
AND rd_thr.param_id2 = 'PER_THRESHOLD_W'
AND TRUNC ( rd.param_value + TO_DATE (START_DATE, 'YYYYMMDD')) < SYSDATE - rd_max.param_value
AND SOURCE = 'MD_IN_MSC_HUA'
GROUP BY TO_CHAR ( TRUNC ( rd.param_value + TO_DATE (START_DATE, 'YYYYMMDD')), 'YYYYMMDD'),
START_HOUR,
IN_PARTNER,
OUT_PARTNER,
SUBSCRIBER_TYPE,
TRAFFIC_TYPE,
EVENT_TYPE,
rd.param_value,
CALLED_NO_GRP,
rd_thr.param_value
) PREV
-------------------------- join ------------------
ON ( CURR.START_DATE = PREV.START_DATE
AND CURR.START_HOUR = PREV.START_HOUR
AND CURR.IN_PARTNER = PREV.IN_PARTNER
AND CURR.OUT_PARTNER = PREV.OUT_PARTNER
AND CURR.SUBSCRIBER_TYPE = PREV.SUBSCRIBER_TYPE
AND CURR.TRAFFIC_TYPE = PREV.TRAFFIC_TYPE
AND CURR.INTERVAL_PERIOD = PREV.INTERVAL_PERIOD
--AND CURR.THRESHOLD        = PREV.THRESHOLD
AND CURR.EVENT_TYPE = PREV.EVENT_TYPE
AND CURR.CALLED_NO_GRP = PREV.CALLED_NO_GRP)
GROUP BY DECODE (CURR.START_DATE, '', PREV.START_DATE, CURR.START_DATE),
DECODE (CURR.START_HOUR, '', PREV.START_HOUR, CURR.START_HOUR),
DECODE (CURR.IN_PARTNER, '', PREV.IN_PARTNER, CURR.IN_PARTNER),
DECODE (CURR.OUT_PARTNER, '', PREV.OUT_PARTNER, CURR.OUT_PARTNER),
DECODE (CURR.SUBSCRIBER_TYPE, '', PREV.SUBSCRIBER_TYPE, CURR.SUBSCRIBER_TYPE),
DECODE (CURR.TRAFFIC_TYPE, '', PREV.TRAFFIC_TYPE, CURR.TRAFFIC_TYPE),
DECODE (CURR.INTERVAL_PERIOD, '', PREV.INTERVAL_PERIOD, CURR.INTERVAL_PERIOD),
--DECODE (CURR.THRESHOLD, '', PREV.THRESHOLD, CURR.THRESHOLD),
DECODE (CURR.EVENT_TYPE, '', PREV.EVENT_TYPE, CURR.EVENT_TYPE),
DECODE (CURR.CALLED_NO_GRP, '', PREV.CALLED_NO_GRP, CURR.CALLED_NO_GRP);
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I changed to query as below, however the performance not much difference compare to original
WITH CURR AS
SELECT /*+ MATERIALIZE */ START_DATE,
START_HOUR,
IN_PARTNER,
OUT_PARTNER,
SUBSCRIBER_TYPE,
TRAFFIC_TYPE,
EVENT_TYPE,
--rd_thr.param_value THRESHOLD,
rd.param_value INTERVAL_PERIOD,
CALLED_NO_GRP,
--SUM (DATA_VOLUME)                                                                                                                       AS DATA_VOLUME,
--SUM (EVENT_DURATION)                                                                                                                    AS EVENT_DURATION,
--DECODE ( SUM (NVL (EVENT_COUNT / 1000000, 0)), 0, 0, ROUND ( SUM (EVENT_DURATION / 1000000) / SUM (NVL (EVENT_COUNT / 1000000, 0)), 2)) AS AVERAGE_DURATION,
SUM (EVENT_COUNT) AS EVENT_COUNT
FROM MSC_OUT_AGG,
raid_t_parameters rd,
raid_t_parameters rd_min,
raid_t_parameters rd_max,
raid_t_parameters rd_thr
WHERE TRUNC (SYSDATE - TO_DATE (START_DATE, 'YYYYMMDD')) <= rd_min.param_value
AND rd_min.param_id = 'histMD_IN_MSC'
AND rd_min.param_id2 = 'DASHBOARD_THRESHOLD_MIN'
AND rd.param_id = 'histMD_IN_MSC'
AND rd.param_id2 = 'INTERVAL_PERIOD'
AND rd_max.param_id = 'histMD_IN_MSC'
AND rd_max.param_id2 = 'DASHBOARD_THRESHOLD_MAX'
AND rd_thr.param_id = 'histMD_IN_MSC'
AND rd_thr.param_id2 = 'PER_THRESHOLD_W'
AND TO_DATE (START_DATE, 'YYYYMMDD') < SYSDATE - rd_max.param_value
AND SOURCE = 'MD_IN_MSC_HUA'
GROUP BY START_DATE,
START_HOUR,
IN_PARTNER,
OUT_PARTNER,
SUBSCRIBER_TYPE,
TRAFFIC_TYPE,
EVENT_TYPE,
rd.param_value,
CALLED_NO_GRP,
rd_thr.param_value
), PREV AS
SELECT /*+ MATERIALIZE */ TO_CHAR ( TRUNC ( rd.param_value + TO_DATE (START_DATE, 'YYYYMMDD')), 'YYYYMMDD') START_DATE,
START_HOUR,
IN_PARTNER,
OUT_PARTNER,
SUBSCRIBER_TYPE,
TRAFFIC_TYPE,
EVENT_TYPE,
rd.param_value INTERVAL_PERIOD,
CALLED_NO_GRP,
--rd_thr.param_value THRESHOLD,
SUM (EVENT_COUNT) AS EVENT_COUNT_PREV
--SUM (EVENT_DURATION)                                                                                                                    AS EVENT_DURATION_PREV,
--DECODE ( SUM (NVL (EVENT_COUNT / 1000000, 0)), 0, 0, ROUND ( SUM (EVENT_DURATION / 1000000) / SUM (NVL (EVENT_COUNT / 1000000, 0)), 2)) AS AVERAGE_DURATION_PREV,
--SUM (DATA_VOLUME)                                                                                                                       AS DATA_VOLUME_PREV
FROM MSC_OUT_AGG,
raid_t_parameters rd,
raid_t_parameters rd_min,
raid_t_parameters rd_max,
raid_t_parameters rd_thr
WHERE TRUNC ( SYSDATE - TRUNC ( rd.param_value + TO_DATE (START_DATE, 'YYYYMMDD'))) <= rd_min.param_value
AND rd.param_id = 'histMD_IN_MSC'
AND rd.param_id2 = 'INTERVAL_PERIOD'
AND rd_min.param_id = 'histMD_IN_MSC'
AND rd_min.param_id2 = 'DASHBOARD_THRESHOLD_MIN'
AND rd_max.param_id = 'histMD_IN_MSC'
AND rd_max.param_id2 = 'DASHBOARD_THRESHOLD_MAX'
AND rd_thr.param_id = 'histMD_IN_MSC'
AND rd_thr.param_id2 = 'PER_THRESHOLD_W'
AND TRUNC ( rd.param_value + TO_DATE (START_DATE, 'YYYYMMDD')) < SYSDATE - rd_max.param_value
AND SOURCE = 'MD_IN_MSC_HUA'
GROUP BY TO_CHAR ( TRUNC ( rd.param_value + TO_DATE (START_DATE, 'YYYYMMDD')), 'YYYYMMDD'),
START_HOUR,
IN_PARTNER,
OUT_PARTNER,
SUBSCRIBER_TYPE,
TRAFFIC_TYPE,
EVENT_TYPE,
rd.param_value,
CALLED_NO_GRP,
rd_thr.param_value
SELECT /*+ USE_HASH(T1 T2) */ DECODE (CURR.START_DATE, '', PREV.START_DATE, CURR.START_DATE) START_DATE,
DECODE (CURR.START_HOUR, '', PREV.START_HOUR, CURR.START_HOUR) START_HOUR,
DECODE (CURR.IN_PARTNER, '', PREV.IN_PARTNER, CURR.IN_PARTNER) IN_PARTNER,
DECODE (CURR.OUT_PARTNER, '', PREV.OUT_PARTNER, CURR.OUT_PARTNER) OUT_PARTNER,
DECODE (CURR.SUBSCRIBER_TYPE, '', PREV.SUBSCRIBER_TYPE, CURR.SUBSCRIBER_TYPE) SUBSCRIBER_TYPE,
DECODE (CURR.TRAFFIC_TYPE, '', PREV.TRAFFIC_TYPE, CURR.TRAFFIC_TYPE) TRAFFIC_TYPE,
DECODE (CURR.EVENT_TYPE, '', PREV.EVENT_TYPE, CURR.EVENT_TYPE) EVENT_TYPE,
DECODE (CURR.INTERVAL_PERIOD, '', PREV.INTERVAL_PERIOD, CURR.INTERVAL_PERIOD) INTERVAL_PERIOD,
--DECODE (CURR.THRESHOLD, '', PREV.THRESHOLD, CURR.THRESHOLD) THRESHOLD,
DECODE (CURR.CALLED_NO_GRP, '', PREV.CALLED_NO_GRP, CURR.CALLED_NO_GRP) CALLED_NO_GRP,
SUM (DECODE (CURR.EVENT_COUNT, '', 0, CURR.EVENT_COUNT)) EVENT_COUNT,
--SUM (DECODE (CURR.EVENT_DURATION, '', 0, CURR.EVENT_DURATION)) EVENT_DURATION,
--SUM (DECODE (CURR.DATA_VOLUME, '', 0, CURR.DATA_VOLUME)) DATA_VOLUME,
--AVG (DECODE (CURR.AVERAGE_DURATION, '', 0, CURR.AVERAGE_DURATION)) AVERAGE_DURATION,
SUM (DECODE (PREV.EVENT_COUNT_PREV, '', 0, PREV.EVENT_COUNT_PREV)) EVENT_COUNT_PREV,
--SUM ( DECODE (PREV.EVENT_DURATION_PREV, '', 0, PREV.EVENT_DURATION_PREV)) EVENT_DURATION_PREV,
--SUM (DECODE (PREV.DATA_VOLUME_PREV, '', 0, PREV.DATA_VOLUME_PREV)) DATA_VOLUME_PREV,
--AVG ( DECODE (PREV.AVERAGE_DURATION_PREV, '', 0, PREV.AVERAGE_DURATION_PREV)) AVERAGE_DURATION_PREV,
ABS ( SUM (DECODE (CURR.EVENT_COUNT, '', 0, CURR.EVENT_COUNT)) - SUM ( DECODE (PREV.EVENT_COUNT_PREV, '', 0, PREV.EVENT_COUNT_PREV))) EVENT_COUNT_DIFF
FROM CURR
FULL OUTER JOIN
PREV
ON ( CURR.START_DATE = PREV.START_DATE
AND CURR.START_HOUR = PREV.START_HOUR
AND CURR.IN_PARTNER = PREV.IN_PARTNER
AND CURR.OUT_PARTNER = PREV.OUT_PARTNER
AND CURR.SUBSCRIBER_TYPE = PREV.SUBSCRIBER_TYPE
AND CURR.TRAFFIC_TYPE = PREV.TRAFFIC_TYPE
AND CURR.INTERVAL_PERIOD = PREV.INTERVAL_PERIOD
--AND CURR.THRESHOLD           = PREV.THRESHOLD
AND CURR.EVENT_TYPE = PREV.EVENT_TYPE
AND CURR.CALLED_NO_GRP = PREV.CALLED_NO_GRP)
GROUP BY DECODE (CURR.START_DATE, '', PREV.START_DATE, CURR.START_DATE),
DECODE (CURR.START_HOUR, '', PREV.START_HOUR, CURR.START_HOUR),
DECODE (CURR.IN_PARTNER, '', PREV.IN_PARTNER, CURR.IN_PARTNER),
DECODE (CURR.OUT_PARTNER, '', PREV.OUT_PARTNER, CURR.OUT_PARTNER),
DECODE (CURR.SUBSCRIBER_TYPE, '', PREV.SUBSCRIBER_TYPE, CURR.SUBSCRIBER_TYPE),
DECODE (CURR.TRAFFIC_TYPE, '', PREV.TRAFFIC_TYPE, CURR.TRAFFIC_TYPE),
DECODE (CURR.INTERVAL_PERIOD, '', PREV.INTERVAL_PERIOD, CURR.INTERVAL_PERIOD),
--DECODE (CURR.THRESHOLD, '', PREV.THRESHOLD, CURR.THRESHOLD),
DECODE (CURR.EVENT_TYPE, '', PREV.EVENT_TYPE, CURR.EVENT_TYPE),
DECODE (CURR.CALLED_NO_GRP, '', PREV.CALLED_NO_GRP, CURR.CALLED_NO_GRP);

Similar Messages

  • HOW TO FINE TUNE QUERY

    Hi,
    I am having below two queries. 2nd query is taking more time & it gives time out error. Can anybody tell how to fine tune below query. Thanks.
    1st Query.
    SELECT EKETEBELN EKETEBELP EKETETENR EKETEINDT
             EKETMENGE EKETWEMNG
             INTO TABLE I_EKET
             FROM EKET
             WHERE EKETMENGE <> EKETWEMNG
                                             AND
                    EKET~EINDT IN  S_EINDT.
      DESCRIBE TABLE I_EKET LINES V_ZLINES.
      IF V_ZLINES > 0.
    2nd Query.
        SELECT EKKOEBELN EKKOAEDAT EKKOLIFNR EKPOEBELP EKPO~MATNR
               EKPO~WERKS
               EKPOLOEKZ EKPOELIKZ EKPOTXZ01 EKPONETPR LFA1~NAME1
               INTO TABLE I_PODEL
               FROM EKKO
               INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
               INNER JOIN LFA1 ON EKKOLIFNR = LFA1LIFNR
               FOR ALL ENTRIES IN I_EKET
               WHERE EKKO~EBELN = I_EKET-EBELN AND
                     EKPO~EBELP = I_EKET-EBELP AND
                     EKPO~MATNR IN  S_MATNR AND
                     EKPO~WERKS IN  S_WERKS AND
                     EKPO~WERKS NE 'W001'   AND
                     EKKO~EKORG = P_EKORG   AND
                     EKKO~LIFNR IN S_LIFNR  AND
                     EKKO~LOEKZ NE 'X'      AND
                     EKPO~LOEKZ NE 'S'      AND
                     EKPO~ELIKZ NE 'X'      AND
                     EKPO~LOEKZ NE 'L'      AND
                     EKKO~AEDAT IN  S_AEDAT.
      ELSE.
        WRITE 'No POs found for the selection criteria!'.
      ENDIF.

    Not the right forum to ask this question.
    VJ

  • Need to fine tune Query ....

    Hi...
    SELECT
    a.id, a.fname, a.lname
    FROM
    a inner join b ON a.id = b.id
    WHERE
    a.del_status = 'N' AND a.type = 2
    GROUP BY
    a.id, a.name, a.lname
    if i run this Query it take s one sec
    SELECT
    a.id, a.fname, a.lname
    FROM
    a inner join b ON a.id = b.id
    WHERE
    a.del_status = 'N' AND a.type = 2 and b.status =1
    GROUP BY
    a.id, a.name, a.lname
    if i add status it takes 7 Min
    i cant found the reason
    this is the explain plan for second query
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE          73           92                     
    SORT GROUP BY          73      3 K     92                     
    NESTED LOOPS          73      3 K     88                     
    TABLE ACCESS FULL     NOTIFY_SOURCE_DETAIL     73      1 K     15                     
    TABLE ACCESS BY INDEX ROWID     MEMBER     1      20      1                     
    INDEX UNIQUE SCAN     I_MEMBER_2     2                               
    Thanks,

    Hi
    If you have an index on the b.id then Oracle does not have to read the actual data in the first query.
    But when you refer to status, then Oracle will have to retrieve the row and check that field.
    pls. supply BOTH explain plans
    regards
    Mette

  • I need to fine tune a query

    Hi All,
    I need to fine tune my select query . I am giving a sample query which is model of my Query .
    Sample Tables: Employee, Manager, Department
    Select a.employee_name,a.employee_age,decode(a.employee_status,'Y','Promoted','Still in Progress'), NVL(b.employee_details , 0),c.department_name from employee a, manager b , department c where a.employee_id =b.employee_id(+) and a.employee_id = c.employee_id(+) and c.department_status in ('Y',A') order by a.employee_joining_date
    This is a sample query. In my query which should be fine tune has lot of decode and nvl functions. This query is passed to oracle as string from Java .It takes 2 seconds but it should be taking only fraction of seconds..
    What shall i do?
    Shall i create materialise views or a function in oracle with return value as sys_refucursor to Java code. does function based index should be used in where clause only. If so what should i do to minimise decode and nvl functions.Please help me

    >
    Select a.employee_name,a.employee_age,decode(a.employee_status,'Y','Promoted','Still in Progress'),
    NVL(b.employee_details , 0),c.department_name from employee a, manager b , department c
    where a.employee_id =b.employee_id(+) and a.employee_id = c.employee_id(+) and c.department_status
    in ('Y',A') order by a.employee_joining_date I'm wondering why an "employee_details" field is 0 - doesn't make much sense to me.
    Also, the (+) syntax is deprecated - use standard ANSI join syntax instead (Mr. Google is your friend).
    This is a sample query. In my query which should be fine tune has lot of decode and nvl functions.
    This query is passed to oracle as string from Java .It takes 2 seconds but it should be taking only fraction of seconds..Why should it take only a fraction of a second? How do you know this for a fact? TKProf should be
    able to tell you what's happening.
    What shall i do?
    Shall i create materialise views or a function in oracle with return value as sys_refucursor to Java code.
    does function based index should be used in where clause only. If so what should i do to minimise
    decode and nvl functions.Please help meSounds to me like you're thrashing around desperately in search of a "fancy" solution.
    Read some performance books on Oracle - you don't mention your version of Oracle
    or your OS, so it's difficult to help with that.
    Christopher Lawson's book is an excellent and very readable into to Oracle performance.
    Also, Oracle Performance 101 - as well as anything by Tom Kyte. More advanced stuff is
    available from Jonathan Lewis and Christian Antognini. Also, take a look at the FAQ for
    this group (as recommended by the other poster) and don't forget the docco*
    or (short version) RTFM*.
    HTH,
    Paul...

  • Query fine tune.

    Dear All,
    I am using 11g version. The query given below.
    Sample Data:
    Table1: KEY ( It has 4 million records and DUR_UK column is unique key)
    PK
    DUR_UK
    1
    BD|4|J650|01AB|0001LLA|N01005309106|01003014101|0H9ZN|0HB0T|6970189|30748R2|001000
    2
    BD|506001022502|06076001901|0G1GF|0HB0T|7270478|2035772C91|000100
    3
    BD|J08005852109|10004001301|0HB0T|6971058|3551787C91|000100|03-MAY-10|31-DEC-99|3551787C91
    Table2: Section (It has 12k records)
    Column: FVC
    Data: OHBOT
    In table 1, there are 3 types of order for bold and underlined data. I need to get the PK, JVC from KEY table by JOINING with Section table based on bold and underlined field with FVC column.
    I tired with below query but it takes long time and didnt complete. Becoz it go thru 4 million records 3 times.
    SELECT A.PK,B.JVC
      FROM SECTION B
    INNER JOIN KEY A
        ON (REGEXP_SUBSTR(A.DUR_UK,'[^|]+',1,9) = B.FVC OR REGEXP_SUBSTR(A.DUR_UK,'[^|]+',1,5) = B.FVC OR REGEXP_SUBSTR(A.DUR_UK,'[^|]+',1,4) = B.FVC;
    The output could be like.
    PK  JVC
    1     OHBOT
    2     OHBOT
    3     OHBOT
    Can someone please help me out to fine tune.
    Thanks

    Hi,
    In a relational database, each column of each row should contain 1 piece of information, not a delimted list of several items.  This is so basic to database design that it's called First Normal Form.  Relational database are designed to work with data that is in First Normal Form.  Your table was not designed to work well, and it seems to be doing exactly what it was designed for.   This problem (and many others, no doubt) would be much simpler and much faster if each of the |-delimited items was on a separate row.
    If you must use the current design, avoid regular expressions.  You don't need all the power of regular expressions in this problem; you can get the results you need faster using less powerful tools, such as LIKE, INSTR and SUBSTR.
    Depending on your data and your requirements, you might try something like this:
    WITH  got_pos  AS
        SELECT  k.pk, k.dur_uk
        ,       s.jvc, s.fvc
        ,       INSTR (k.dur_uk, '|', 1, 3)  AS pos3
        ,       INSTR (k.dur_uk, '|', 1, 4)  AS pos4
        ,       INSTR (k.dur_uk, '|', 1, 5)  AS pos5
        ,       INSTR (k.dur_uk, '|', 1, 8)  AS pos8
        ,       INSTR (k.dur_uk, '|', 1, 9)  AS pos9
        FROM    section  s
        JOIN    key      k  ON  k.dur_uk  LIKE '%|' || s.fvc || '|%'
    SELECT  pk, jvc
    FROM    got_pos
    WHERE   fvc IN ( SUBSTR (dur_uk, pos3 + 1, pos4 - (pos3 + 1))
                   , SUBSTR (dur_uk, pos4 + 1, pos5 - (pos4 + 1))
                   , SUBSTR (dur_uk, pos8 + 1, pos9 - (pos8 + 1))
    Of course, without any sample data, I can't test this.
    Oracle Text might help with this problem.  I don't use it myself, but I believe it allows you to create indexes so that it's faster to find keywords (such as anyhting in section.fvc) anywhere in large strings (such as key.dur_uk).

  • SQL stmt fine tunning

    Hi DBA,
    i am new to this field.
    i can see from EM some sql are taking 8%- 95% of Db . i get the SQL_ID from the Em how to fine tune this?
    also can you please help me out with some standard recommendations to run the DB in best manner.
    Thanks in advance.

    As a generic recommendation for slow sql queries, read the following thread ,
    When your query takes too long ...
    HTH
    Aman....

  • Fine Tune Procedure

    Hi, Everyone,
    My oracle database version is oracle 11.2.0.1.
    I am running this procedure in a pl/sql package.  When i the process comes to running this process it does not come back.  Could you please help me to fine tune this procedure
    PROCEDURE ICM_MIN_PR_DIFF        
    (V_LOW IN NUMBER,
    V_UP IN NUMBER)
    AS
    L_INS_TABLE VARCHAR2(4000);
    L_QRY_1_PART VARCHAR2(4000);
    L_QRY_2_PART VARCHAR2(4000);
    L_QRY_3_PART VARCHAR2(4000);
    L_QRY_POPULATE VARCHAR2(4000);
    BEGIN
    EXECUTE IMMEDIATE 'TRUNCATE TABLE ICM_MIN_PRDIFF_0';
    L_QRY_1_PART := '    select  a.customer_no,a.pr_code_bbl,a.score,min(b.price_diff) price_diff, a.flag
    from ICM_MAX_SCORE_0 a, icm b
    where 
    a.customer_no = b.customer_no
    and a.pr_code_bb=b.pr_code_bb
    and a.score = b.score
    and a.flag = b.flag
    and b.price_diff > 0
    and b.score >=0.5
    and b.flag = 0
    and b.price_diff > ';
    L_QRY_2_PART := ' AND  b.price_diff <= ';
    L_QRY_3_PART := ' GROUP BY a.customer_no,a.pr_code_bb,a.score,a.flag ';
    L_QRY_POPULATE := L_QRY_1_PART || V_LOW ||L_QRY_2_PART || V_UP || L_QRY_3_PART;
    --Construct Insertion Statment by appending the Query Statement
    L_INS_TABLE := 'INSERT /*APPEND */ INTO ICM_MIN_PRDIFF_0 ' ||
    L_QRY_POPULATE;
    --DBMS_OUTPUT.PUT_LINE(L_INS_TABLE);
    DBMS_OUTPUT.PUT_LINE('POPULATED ICM_MIN_PRDIFF_0');
    EXECUTE IMMEDIATE L_INS_TABLE;
    COMMIT;
    END ICM_MIN_PR_DIFF;
    The following is the explain plan for the query
    plan FOR succeeded.
    PLAN_TABLE_OUTPUT                                                                                                                                                                                                                                                                                         
    Plan hash value: 636749222                                                                                                                                                                                                                                                                                  
    | Id  | Operation                | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                                         
    |   0 | INSERT STATEMENT         |                                |  1390K|   132M|       |  1796K  (1)| 05:59:13 |                                                                                                                                                                                         
    |   1 |  LOAD TABLE CONVENTIONAL | ICM_MIN_PRDIFF_0 |       |       |       |            |          |                                                                                                                                                                                         
    |   2 |   HASH GROUP BY          |                                |  1390K|   132M|   155M|  1796K  (1)| 05:59:13 |                                                                                                                                                                                         
    |*  3 |    HASH JOIN             |                                |  1390K|   132M|    68M|  1764K  (1)| 05:52:54 |                                                                                                                                                                                         
    |*  4 |     TABLE ACCESS FULL    | ICM_MAX_SCORE_0 |  1390K|    53M|       |  2478   (1)| 00:00:30 |                                                                                                                                                                                         
    |*  5 |     TABLE ACCESS FULL    | ICM                |    10M|   611M|       |  1722K  (1)| 05:44:26 |                                                                                                                                                                                         
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                                         
       3 - access("A"."CUSTOMER_NO"="B"."CUSTOMER_NO" AND "A"."PR_CODE_BB"="B"."PR_CODE_BB" AND                                                                                                                                                                                                               
                  "A"."SCORE"="B"."SCORE" AND "A"."FLAG"="B"."FLAG")                                                                                                                                                                                                                                            
       4 - filter("A"."FLAG"=0 AND "A"."SCORE">=0.5)                                                                                                                                                                                                                                                            
       5 - filter("B"."PRICE_DIFF"<=10 AND "B"."SCORE">=0.5 AND "B"."PRICE_DIFF">0 AND "B"."FLAG"=0)                                                                                                                                                                                                            
    20 rows selected
    select count(1) from ICM_MAX_SCORE_0 = 1390409
    select count(1) from ICM = 586260240

    please look at the explain plan for the sql after implementing your advice
    explain plan for
    insert /*+ append */ into ICM_MIN_PRDIFF_0 (customer_no,pr_code_bb,score,price_diff,flag)
    select  a.customer_no,a.pr_code_bb,a.score,min(b.price_diff) price_diff, a.flag
    from ICM_MAX_SCORE_0 a, icm b
    where   a.customer_no = b.customer_no
    and a.pr_code_bb=b.pr_code_bb
    and a.score = b.score
    and a.flag = b.flag
    and b.price_diff > 0
    and b.score >=0.5
    and b.flag = 0
    and b.price_diff > 0
    AND  b.price_diff <= 10
    GROUP BY a.customer_no,a.pr_code_bb,a.score,a.flag ;
    SELECT * FROM TABLE(dbms_xplan.display);
    plan FOR succeeded.
    PLAN_TABLE_OUTPUT                                                                                                                                                                                                                                                                                         
    Plan hash value: 4089758326                                                                                                                                                                                                                                                                                 
    | Id  | Operation            | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                                             
    |   0 | INSERT STATEMENT     |                                |  1390K|   132M|       |  1796K  (1)| 05:59:13 |                                                                                                                                                                                             
    |   1 |  LOAD AS SELECT      | ICM_MIN_PRDIFF_0 |       |       |       |            |          |                                                                                                                                                                                             
    |   2 |   HASH GROUP BY      |                                |  1390K|   132M|   155M|  1796K  (1)| 05:59:13 |                                                                                                                                                                                             
    |*  3 |    HASH JOIN         |                                |  1390K|   132M|    68M|  1764K  (1)| 05:52:54 |                                                                                                                                                                                             
    |*  4 |     TABLE ACCESS FULL| ICM_MAX_SCORE_0 |  1390K|    53M|       |  2478   (1)| 00:00:30 |                                                                                                                                                                                             
    |*  5 |     TABLE ACCESS FULL| ICM                |    10M|   611M|       |  1722K  (1)| 05:44:26 |                                                                                                                                                                                             
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                                         
       3 - access("A"."CUSTOMER_NO"="B"."CUSTOMER_NO" AND "A"."PR_CODE_BB"="B"."PR_CODE_BB" AND                                                                                                                                                                                                               
                  "A"."SCORE"="B"."SCORE" AND "A"."FLAG"="B"."FLAG")                                                                                                                                                                                                                                            
       4 - filter("A"."FLAG"=0 AND "A"."SCORE">=0.5)                                                                                                                                                                                                                                                            
       5 - filter("B"."PRICE_DIFF"<=10 AND "B"."SCORE">=0.5 AND "B"."PRICE_DIFF">0 AND "B"."FLAG"=0)                                                                                                                                                                                                            
    20 rows selected

  • Using flex pitch is there a way to fine tune the start point .i'm using it as a audio to  midi function

    using flex pitch is there a way to fine tune the start point .i'm using it as a audio to  midi function

    Thank you for your reply Karsten but unfortunately this didn't help me so far. Or maybe I'm missing something?
    First the link is a tutorial for iMovie on a Mac. I'm using iMovie on iPad so the steps are inapplicable.
    Second it is only possible for me to manipulate the end part of the sound clip to whichever duration I want. But I can't do the same with the 'beginning' of the sound clip.
    I simply want to place some photos in the beginning of my video with no sound in the background then after like 2 secs I want to start the music clip. For some reason that is not possible! Cause every time I drop the music clip unto my project timeline it automatically place it self along with the first frame in the project! And consequently the photos and music are forced to start together.
    Hope I'm making sense...

  • How do you fine tune an effect in Captivate 6

    I'm trying to scale and move a video using the effects timeline and I want it to wind up in an exact location on the stage. Is there any way to fine tune it by entering in exact coordinates rather than by bouncing back & forth between Live Preview and Edit View? I'm used to being able to entering in exact numbers when tweening an object in Flash and this seems like a pretty bad way of moving things around on the screen. Am I missing something here?
    Thanks

    As a temporary workaround, this is my work flow:
    I create a 'crosshair' in the exact location, using two line shapes that can be positioned exactly using the Transform accordion.
    The motion path end points have a circle that you'll have to drag over the crosshair. Motion paths use the center point of an object, contrary to resizing, moving that is from the upper left corner of the bounding box. I used the described work flow in the first movie here: http://blog.lilybiri.com/reset-effects
    Lilybiri

  • Will pay Spry Expert to fine tune vertical menu bar

    Hi,
    I have created a menu bar with DW CS4 for one of my web design clients, and I am running out of time to fine tune it.
    So I will pay an expert who can:
    1. Reduce the font size to small (maybe 8pt) on all items because the client has way too many items.
    2. Reduce the line height size to 4pt for the same reason.
    3. Stop submenu items from appearing on the left side of the window outside the menu bar.
    I am happy with the bg color and arial font.
    You can see the bar at: http://faithandfamilynutrition.com/
    Please let me know if you can do this job and how much you would charge.
    Thanks

    Hi,
    Never mind. Trial and error, figured it out using the CSS menu that came up when I clicked different sections of the widget.
    Thanks anyway

  • How to fine tune ROIs of LEDs of a camera image?

    Hi,
    I use NI Smart Camera and NI Vision Builder 2012 for measuring HUE values of the LEDs. I can manually adjust the ROI of each LED. Sometimes mechanics move a bit and my ROIs are then tilted/off from LED and measurement results are staring to fail. I am wondering how to set vision builder/camera to automatically fine tune ROIs when needed? I attach a sample picture of LEDs. There is also situation where I manually fine tune LED D79's ROI.
    BR,
    Jick
    Attachments:
    LEDs.png ‏37 KB

    Thanks for the example. There is still one open question: how do I detect if one LED is OFF? For example if one LED is missing Detect Objects 1 step finds one object less but how can I know which LED is missing/off? How about creating Detect Object step for each LED separately and if there is no LED on measure colors step just fails? I attach my suggestion here.
    BR,
    Jick
    Attachments:
    Adjust_ROIs.vbai ‏114 KB
    camera_simulation_image2.png ‏26 KB

  • How to fine tune a software instrument

    Can anyone tell me how to fine-tune a software instrument that's a little sharp for my audio track? Is there an easy way to do that?

    Which instrument? Here it is for the EXS24 II.

  • Fine Tune

    Hi,
    How to check our DB is Fine Tune?
    what is the meaning of Fine Tune?
    Plz ....
    reagards

    Fine tuning is a term from mechnical engineering. It means making very small adjustments to very particular areas of an engine in the quest for perfect performance. A Formula Racing car is fine-tuned. The average family saloon car is not.
    How to check our DB is Fine Tune?If you have to ask it isn't ;)
    Cheers, APC

  • Can I fine tune the Ken Burns effect?

    I'm using iPhoto 6 for the first time - making a slide show. I turned off the default Ken Burns effect for all slides, but I'm manually setting the KB effect on some slides. I like the ability to specify the starting view and the ending view - such as starting the view with a close-up of a bottle of wine, then zooming back to show the table full of food and the people around it, but....
    Is it possible to "fine tune" the KB effect as follows: Have it show the starting view for a specified period of time (e.g. one second), then specify the transition time (e.g. 3 seconds), then have it show the final view for a specified period of time (e.g. 2 seconds).
    I.e., I'd like to set up the KB effect so that it "lingers" on the starting view and ending view for a time period that I specify. Is this possible? (If not, this would be a great feature to add in a future release.)

    You can kinda do that in iPhoto. It's possible to set individual slide display times with the Adjust pane in the slideshow mode if you don't have the Fit slideshow to Music option selected. You can also set transitions and speed of transition.
    To get music to end at the end you will have to estimate the time of the slideshow and use music with a time close to that time. I use a blank, black slide at the end of my slideshow so that the music will end to a blank screen if I miss the timing a bit instead of starting over.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. Just put the application in the Dock and click on it whenever you want to backup the dB file. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    Note: There's now an Automator backup application for iPhoto 5 that will work with Tiger or Leopard.

  • Rowby's Raid Ready to Fine Tune

    Well now that I have my raid ready, I'm itching to get CS5 installed.
    But I guess that will have to wait until I fine tune the raid.
    I've read  Harm's articles about deviding the activity but am not exactly sure how to do it -- I have a Raid3.  But beyond that I am clueless.
    I'll read more of Harm's articles.
    But perhaps you have a QUICK START (or a quick start link)  so I can go Click click click and then it's all finished and I can install CS5!
    Rowby
    While I figure out how to do the swap file etc.  I installed CS5 and am now downloading the update.   I already hacked the video file to include my "unsupported" GTX480 card.   Updating the Master Collelction (I don't have the creative collection installed yet).  to Premiere CS5 5.0.1   .
    So as soon as the CS5 upgrade finishes (about 45 minutes) I'm going to STACK some videos on the timeline.  And probably for fun do the benchmark to see how my untweaked system looks.

    he motherboard is the main component inside the case. It is a large  rectangular board with integrated circuitry that connects the rest of  the parts of the computer including the CPU,  the RAM, the disk drives (CD,  DVD, hard disk, or any others) as well as any  peripherals connected via the ports or the expansion slots.
    [url=http://www.panamastays.com/Panama-Apartamentos] apartamentos en panama/url]

Maybe you are looking for