SELECT on IOT slow

I have a big index organized table (> 50 million entries):
CREATE TABLE MEASURE_DATA_IOT (
  SERIAL          VARCHAR2(255) NOT NULL,
  DEVICE_TYPE     NUMBER(10,0) NOT NULL,
  DEVICE_ID     VARCHAR2(255) NOT NULL,
  VALUE_TYPE      NUMBER(10,0) NOT NULL,
  TIMESTAMP       TIMESTAMP(6) NOT NULL,
  VALUE           FLOAT NOT NULL,
  CONSTRAINT MEASURE_DATA_IOT_PK PRIMARY KEY(SERIAL, DEVICE_TYPE, DEVICE_ID, VALUE_TYPE, TIMESTAMP)
ORGANIZATION INDEX;
-- a SERIAL as some DEVICEs with TYPE and ID, each DEVICE produces many VALUEs that have a TYPE and a TIMESTAMPSelects using all columns of the PK are very fast. But other querie are very slow (> 10 min.):
-- DEVICEs of TYPE 1 belong to a given SERIAL?
SELECT
  md.serial,
  md.device_id
FROM
  measure_data_iot md
WHERE
  md.serial = :serial
  AND md.device_type=1
GROUP BY
  md.serial,
  md.device_id;
ORDER BY
  md.serial,
  md.device_id;
-- last activity on a given SERIAL?
select max(md.TIMESTAMP) from MEASURE_DATA_IOT md where md.SERIAL = :serial;Any idea, who to speed up those queries?

>
> Any idea, who to speed up those queries?
yes.
start with reading this thread --> [HOW TO: Post a SQL statement tuning request - template posting|http://forums.oracle.com/forums/thread.jspa?threadID=863295]

Similar Messages

  • Variable selection is very slow in WAD

    Hi All,
    Variable selection is very slow, It  takes 2 min to 3 min to get the variable list.
    There are Lots of Data in the system and This query is from Multicube
    please help me out from this issue. It's Urgent !!
    Thanks,
    Greg

    Hi Greg,
    I have the same issue.
    It is very important to improve performance of the F4 function in the web.
    For one query in BEx, it takes about 2 seconds to open the F4 screen for 0CUSTOMER. In the web (WAD) it takes a lot more even with HTTP compression enabled!
    Anybody with a solution to improve performance of the variable selection screen?
    Thanks!

  • Why is the select Count too slow

    I am doing the following select count and calling it from my JSP to get the total number of records... why is it so slow...
    select count(*)
    from
    (select distinct o.receive_id, o.name, o.address
    from order o, item i
    where o.id = i.id
    and o.status = 2 and i.status = 0)

    If the data in the table that you are referring to in the query gets refreshed very often and your high water mark on your table not reset, then this query always runs longer. While deleting data in the table, use 'TRUNCATE' rather than 'DELETE' in your data queries. that would help reset the high water mark and your count() queries will run very very fast.

  • Application selects  is relatively slow in some times

    Dear Friends,
    Some selects of our application is relatively slow in some times (When database is slow) . But same selects shown good performance in most of the time. Database is always not slow in peak hours. I feel there would be insufficient space in Execution plan area or Sort area.
    Can you give me how i change these settings in my database. and where these execution plan and sort area located.
    regards
    upul Indika.

    Hi,
    Try to check for the SGA size in your database. Accordingly increase the shared pool size and the buffer cache size which wil generally improve the performance of the queries. Make sure you donot increase the sixe of shared pool in excess of the size of the SGA.
    Regards
    Bharath

  • Nested Tables select query soooooo slow

    I know that varrays are supposed to be used for small arrays. But, we are comparing nested tables to varrays and two table joins. Nested table query is unimaginably ,unacceptably slow.
    Is there anybody else out there who experienced the same thing. Are there ways to speed up the select queries.(besides indexes)

    If you try to use nested sql statement. Please be sure to setup the index to some specific tables inside oracle
    Doing this will speed up your performance about 5 ~ 9 times original.
    [email protected]

  • SELECT DISTINCT very slow

    hi @all
    I'm using Oracle 11g R2 on Windows 7
    Unfortunately i have a column in a table that stored multiple vales delimited with *,* e.g. [+*execute 1B-B-06-34-61-00A-281A-A, 1B-B-06-37-10-00A-281A-A, 1B-B-06-37-20-00A-281A-A, 1B-B-06-37-30-00A-281A-A*+]
    I have to query that column to get seperate values after execute
    Example:
    Serial_No Remarks
    ---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    AS0007 execute 1B-B-06-34-61-00A-281A-A, 1B-B-06-37-10-00A-281A-A, 1B-B-06-37-20-00A-281A-A, 1B-B-06-37-30-00A-281A-A
    ---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    AS0007 execute 1B-B-28-52-00-00A-340C-A
    ---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    AS0007 execute 1B-B-57-11-03-06A-281A-A, 1B-B-57-11-03-07A-281A-A, 1B-B-57-11-03-07B-281A-A,
    ---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    expected Output:
    Serial_No Remarks
    ---------|----------------------------------------------------------------
    AS0007 1B-B-06-34-61-00A-281A-A
    ---------|----------------------------------------------------------------
    AS0007 1B-B-06-37-10-00A-281A-A
    ---------|----------------------------------------------------------------
    AS0007 1B-B-06-37-20-00A-281A-A
    ---------|----------------------------------------------------------------
    AS0007 1B-B-06-37-30-00A-281A-A
    ---------|----------------------------------------------------------------
    AS0007 1B-B-28-52-00-00A-340C-A
    ---------|----------------------------------------------------------------
    AS0007 1B-B-57-11-03-06A-281A-A
    ---------|----------------------------------------------------------------
    AS0007 1B-B-57-11-03-07A-281A-A
    ---------|----------------------------------------------------------------
    AS0007 1B-B-57-11-03-07B-281A-A
    I have the following Script to query this:
    select distinct SCHED_MAINT.AC_SERIAL_NO, regexp_substr (SUBSTR(SCHED_MAINT.Remarks, 9), '[^,]+', 1, level) as DMC
    from SCHED_MAINT
    where SCHED_MAINT.NEXT_DUE_MINS = '24000'
    and SCHED_MAINT.AC_SERIAL_NO = 'AS0007'
    connect by prior SCHED_MAINT.AC_SERIAL_NO = SCHED_MAINT.AC_SERIAL_NO
    and regexp_instr (SCHED_MAINT.Remarks, '[^,]+', 1, level) > 0
    and prior dbms_random.string ('p', 10) is not null;
    The Problem is that, with this few rows it works, but slow, if i have more rows e.g 1000, I killed the runtime after 2h without any output
    If I run this script without the DISTINCT it runs fast in one second but i get duplicated rows
    any suggestions to solve this problem
    unfortunately i cannot use funktions or procedures
    thanks in advanced
    cu ice

    WITH clause is just aon-the-fly sample of your real table. Simply remove WITH clause and run:
    select  distinct ac_serial_no,
                     trim(regexp_substr(remarks,'[^,]+',9,column_value)) as DMC
      from  sched_maint,
            table(
                  cast(
                       multiset(
                                select  level
                                  from  dual
                                  connect by level < regexp_count(remarks,',',9) + 1
                       as sys.OdciNumberList
    / And it would take you less time to test multiple ac_serial_no than to post the question:
    with sched_maint as (
                         select 'AS0007' ac_serial_no,'execute 1B-B-06-34-61-00A-281A-A, 1B-B-06-37-10-00A-281A-A, 1B-B-06-37-20-00A-281A-A, 1B-B-06-37-30-00A-281A-A' remarks from dual union all
                         select 'AS0007','execute 1B-B-28-52-00-00A-340C-A' from dual union all
                         select 'AS0007','execute 1B-B-57-11-03-06A-281A-A, 1B-B-57-11-03-07A-281A-A, 1B-B-57-11-03-07B-281A-A' from dual union all
                         select 'AS0008' ac_serial_no,'execute 1B-B-06-34-61-00A-281A-A, 1B-B-06-37-10-00A-281A-A, 1B-B-06-37-20-00A-281A-A, 1B-B-06-37-30-00A-281A-A' remarks from dual union all
                         select 'AS0008','execute 1B-B-28-52-00-00A-340C-A' from dual union all
                         select 'AS0008','execute 1B-B-57-11-03-06A-281A-A, 1B-B-57-11-03-07A-281A-A, 1B-B-57-11-03-07B-281A-A' from dual
    select  distinct ac_serial_no,
                     trim(regexp_substr(remarks,'[^,]+',9,column_value)) as DMC
      from  sched_maint,
            table(
                  cast(
                       multiset(
                                select  level
                                  from  dual
                                  connect by level < regexp_count(remarks,',',9) + 1
                       as sys.OdciNumberList
    AC_SER DMC
    AS0007 1B-B-06-34-61-00A-281A-A
    AS0007 1B-B-06-37-10-00A-281A-A
    AS0007 1B-B-06-37-20-00A-281A-A
    AS0007 1B-B-28-52-00-00A-340C-A
    AS0007 1B-B-57-11-03-06A-281A-A
    AS0007 1B-B-57-11-03-07A-281A-A
    AS0008 1B-B-06-34-61-00A-281A-A
    AS0008 1B-B-06-37-10-00A-281A-A
    AS0008 1B-B-06-37-20-00A-281A-A
    AS0008 1B-B-28-52-00-00A-340C-A
    AS0008 1B-B-57-11-03-06A-281A-A
    AC_SER DMC
    AS0008 1B-B-57-11-03-07A-281A-A
    12 rows selected.
    SQL> SY.

  • Select * query is slow on one particular table

    Hi ,
    I am using forms and reports of AppServer 10g,one particular form accesing one table ...The select * from statement on that table is slow.Any amendmends to be taken care of at the tablespace level??
    Help needed urgent...
    Regards,
    Ashlee

    Hi,
    This is a general type of question. please be specific. Golden Thumb rule is that don't use '*", instead use the column names. Analyze the table and take a execution plan and check for index usage .
    Please give the problem statement also so that we can help you.

  • Select statement is slow

    Hi Folks,
    I thought maybe you could help me here -
    Oracle version is 9.2.0.7
    I am running a select statement against a table. There are no filter conditions
    The statement is
    SELECT * from Table1
    This statement takes 500 sec to execute before I see any data. The table has around 1 million records.
    There is no VPD on the table; there are no locks or latches on the table when the query is executed.
    Other issues with the table are:
    1. SQL*Loader takes 2-3 hours to load data
    2. A simple delete of 1 record takes 1 hour (there are no constraints on this table).
    I monitored the WAIT events: I see db file scattered read and a lot of time is spent on db_single_file_read.
    This happens in production. The server has 8 CPUs and I am the only user logged in.
    These issues are not observed in UAT environment.
    In production, workarea_size_policy is set to AUTO and db_cache_advice is ON.
    The same parameters are set to MANUAL and READY, respectively, in UAT.
    Any suggestions on why getting the first record using a straight SELECT statement would take 500 sec?
    Thanks

    Justin here are the Trace details:
    The wait is on db_file_scattered_read: 700+sec
    The SELECT statement executed is
    SELECT * from tmpfeedsettlement where rownum < 10
    Used 10046 events with level 12
    TKPROF: Release 9.2.0.1.0 - Production on Thu May 24 12:44:19 2007
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Trace file: v:\shakti\o01scb3_ora_14197.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    alter session set sql_trace=true
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        1      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Optimizer goal: CHOOSE
    Parsing user id: 296  (P468707)
    alter session set events '10046 trace name context forever,level 12'
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 296  (P468707)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       1        0.00          0.00
      SQL*Net message from client                     1       22.45         22.45
    select *
    from
    tmpfeedsettlement where rownum < 10
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        2    102.42     765.63     977140     977202          0           9
    total        4    102.43     765.63     977140     977202          0           9
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 296  (P468707)
    Rows     Row Source Operation
          9  COUNT STOPKEY
          9   TABLE ACCESS FULL TMPFEEDSETTLEMENT
    Rows     Execution Plan
          0  SELECT STATEMENT   GOAL: CHOOSE
          9   COUNT (STOPKEY)
          9    TABLE ACCESS   GOAL: ANALYZED (FULL) OF 'TMPFEEDSETTLEMENT'
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      SQL*Net more data to client                     2        0.00          0.00
      db file scattered read                      61181        5.62        719.27
      db file sequential read                         7        0.00          0.00
      SQL*Net message from client                     2      336.11        336.12
    alter session set sql_trace=false
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 296  (P468707)
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        3      0.01       0.00          0          0          0           0
    Execute      4      0.00       0.00          0          0          0           0
    Fetch        2    102.42     765.63     977140     977202          0           9
    total        9    102.43     765.64     977140     977202          0           9
    Misses in library cache during parse: 3
    Misses in library cache during execute: 1
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       3        0.00          0.00
      SQL*Net message from client                     3      336.11        358.57
      SQL*Net more data to client                     2        0.00          0.00
      db file scattered read                      61181        5.62        719.27
      db file sequential read                         7        0.00          0.00
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        0      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
        4  user  SQL statements in session.
        0  internal SQL statements in session.
        4  SQL statements in session.
        1  statement EXPLAINed in this session.
    Trace file: v:\shakti\o01scb3_ora_14197.trc
    Trace file compatibility: 9.00.01
    Sort options: default
           1  session in tracefile.
           4  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           4  SQL statements in trace file.
           4  unique SQL statements in trace file.
           1  SQL statements EXPLAINed using schema:
               P468707.prof$plan_table
                 Default table was used.
                 Table was created.
                 Table was dropped.
       61246  lines in trace file.

  • SELECT query very slow, need suggestion.

    Dear all,
    Below stmt was coded in my report program.
    It was taking around 14 seconds in development system. The days in s_datum was just 1 or 2 days max.
    But when the same was transferred to test system, it is taking almost 10 minutes, though it we gave just 1 day.
      SELECT * FROM likp INTO TABLE i_likp                  
            WHERE erdat IN s_datum AND wadat_ist > '00000000' 
              AND lfart <> 'EL'                               
              AND vstel not in s_vstel.
    Some of you might suggest to make SELECT query with only s_datum, but i tried it in dev system, it was taking almost 22 secs with only s_datum.  I thought it could be more worse in test system so, did not move that idea.
    Can some one please suggest me why it is happening so.

    Hi,
    The difference, as I suppose you know, happens because LIKP probably has much more records in production than in the development system.
    You must think what is selective in your WHERE clause:
    - erdat in s_datum is selective if you are are only using one day
    - wadat_ist GE '00000000' is not selective (all deliveries with goods issue fulfill that condition)
    - lfart NE 'EL' probably is not selective
    - vsten not in s_vstel probably is not selective
    So in the end only erdat is selective. There is no index in LIKP by ERDAT, so if you really want to make it faster you would need an index by ERDAT.
    Still, if you are only making one SELECT (not inside a loop) I wouldn't expect that to take more than 10 minutes.
    I would measure the program with SE30 to make sure it is really the SELECT that is taking so much time (post here the results), and if it really is the select post here the explain plan.
    By the way, if you need to know all goods issues for the last day I would use change pointers instead.
    Hope this helps,
    Rui Dantas

  • Select count(*) VERY slow!

    The table has only 8 columns and 5 way partitioned.
    It was fine till it had 550 million rows [Oracle 11g + Windows XP Pro]. Select count(*) from table used to take ~ 500 seconds.
    When records count reached 600 million, suddenly looks like database hit a brick wall. Now even select count(*) runs for whopping 2800 seconds!!
    What went wrong by just adding 50 million extra records??
    Thanx.

    analyze table Has been obsoleted by DBMS_STATS package.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4005.htm#sthref5767
    Note:
    Do not use the COMPUTE and ESTIMATE clauses of ANALYZE to collect optimizer statistics. These clauses are supported for backward compatibility. Instead, use the DBMS_STATS package, which lets you collect statistics in parallel, collect global statistics for partitioned objects, and fine tune your statistics collection in other ways. The optimizer, which depends upon statistics, will eventually use only statistics that have been collected by DBMS_STATS. See PL/SQL Packages and Types Reference for more information on the DBMS_STATS package.
    Edited by: sb92075 on May 16, 2009 11:36 AM

  • Select is running slow on indexed column

    Hi All,
    I have a table with 11 partitions defined .
    Number of rows in the table is 698 Million rows.
    I have created one index on this table on a single field like below
    create index on router(org) nologging parallel 8;
    org is a 15 byte width varchar2 column.
    index is successsfully created .But when i try to query like below
    select count(1) from router where org='134FGT';
    It takes long time . running for more than 3 mins and still waiting .
    When i checked   explain plan for above statement , its taking index path and cpu time shown as 00:00:01 and cost 2
    Oracle version Ora 10gR2 , installed on Solaris 10 , 16 Dual core machine.
    can any one tell me what is the issue here ???
    Thanks

    Hello, what is your partitioning strategy, i.e., range, hash, or composite?
    Can you post:
    a) The exact DDL of your index creation statement
    b) An explain plan, using:
    EXPLAIN PLAN FOR
    SELECT...
    SELECT * FROM TABLE(dbms_xplan.display);c) Preferably a trace (tkprof) of the operation.

  • Shift select is super slow

    I just installed Illustrator CC and it is quick and responsive except when I shift select a second object. Then I get perhaps a 5 second period of unresponsiveness, after which I can select other objects normally. Any suggestions? (Illustrator CC, Windows 7)

    I created a view with about 6500 records and it takes 4 hours to query from it.
    db file sequential read 299,475 0 208 1 28.48
    log file parallel write 18,823 0 63 3 1.79
    log file sync 9,001 0 62 7 0.86
    Queue Monitor Task Wait 12 12 60 4,985 0.00
    control file parallel write 1,209 0 15 13 0.11
    db file parallel write 4,139 0 13 3 0.39
    SQL*Net more data to client 93,762 11 4 0 8.92
    direct path read 1,727 0 4 2 0.16
    process startup 73 0 2 31 0.01
    db file parallel read 153 0 2 13 0.01
    control file sequential read 481 0 2 3 0.05
    db file scattered read 466 0 1 1 0.04
    SQL*Net message to client 100,254 0 0 0 9.53
    SQL*Net more data from client 408 0 0 0 0.04
    SQL*Net break/reset to client 24 0 0 1 0.00
    LGWR wait for redo copy 20 1 0 0 0.00
    direct path write 354 0 0 0 0.03
    rdbms ipc reply 6 0 0 0 0.00
    latch free 106 0 0 0 0.01
    virtual circuit status 90,711 1,695 54,197 597 8.63
    SQL*Net message from client 100,250 0 25,040 250 9.53
    Queue Monitor Wait 119 119 3,570 29,999 0.01
    wakeup time manager 45 33 3,231 71,811 0.00
    jobq slave wait 766 738 2,268 2,961 0.07
    class slave wait 14 14 70 4,985 0.00
    Queue Monitor Slave Wait 1 1 60 59,998 0.00
    I was thinking of trying a stored procedure that extracts the data just like the views do then post it in a temp table?

  • Selection to covp table is slow

    hi guys,
    i am doing a selection to table covp, its a view table .. how can i tune up the selection process
    SELECT * INTO CORRESPONDING FIELDS OF TABLE tcovp BYPASSING BUFFER
                           FROM covp
                           FOR ALL ENTRIES IN itab
                           WHERE objnr EQ itab-objnr
                                     AND   wrttp IN   p_wrttp
                                     AND   kstar IN p_kstar
                                     AND   budat IN p_budat.
    SELECT * INTO CORRESPONDING FIELDS OF TABLE tcovp1
                       BYPASSING BUFFER
                            FROM covp  FOR ALL ENTRIES IN tafvc
                                       WHERE objnr EQ tafvc-objnr
                                       AND   wrttp IN p_wrttp
                                       AND   kstar IN p_kstar
                                       AND   budat IN p_budat.

    hi guys,
    i have used this code
    IF NOT itab[] IS INITIAL.
        SELECT bukrs kstar budat wkgbtr awtyp refbn refgj refbk objnr
           into TABLE tcovp BYPASSING BUFFER
                           FROM covp
                           FOR ALL ENTRIES IN itab
                           WHERE objnr EQ itab-objnr
                                     AND   wrttp IN   p_wrttp
                                     AND   kstar IN p_kstar
                                     AND   budat IN p_budat.
    endif
    but still the selection data is slow and yes itab can contain up to 30k data..
    how can i split the itab data ? and up to how many lines

  • Select is slow

    Hi, the following select is very slow :
    SELECT "EN_PERSON"."NAME",
    "EN_PERSON"."FIRSTNAMES",
    "EN_CONTRACT"."NRWORKER",
    "EN_AMENDMENT"."NROCCUR",
    "EN_AMENDMENT"."ENTRYDATE",
    "EN_AMENDMENT"."OUTDATE",
    "EN_CONTRACT"."ROW_ID",
    "EN_CONTRACT"."F_PAYGROUP",
    "EN_CONTRACT"."F_DEPARTMENT",
    "EN_CONTRACT"."F_EMPLOYER",
    "EN_AMENDMENT"."ROW_ID",
    "EN_PERSON"."ROW_ID",
    "EN_EMPLOYER"."DOSSIER",
    "EN_AMENDMENT"."NR_CT_AM",
    "EN_AMENDMENT"."F_TIMEGRID"
    FROM "EN_AMENDMENT",
    "EN_CONTRACT",
    "EN_PERSON",
    "EN_EMPLOYER"
    WHERE ( "EN_PERSON"."ROW_ID" = "EN_CONTRACT"."F_PERSON" ) and
    ( "EN_CONTRACT"."ROW_ID" = "EN_AMENDMENT"."F_CONTRACT" ) and
    ( "EN_CONTRACT"."F_EMPLOYER" = "EN_EMPLOYER"."ROW_ID" ) and
    ( ( "EN_AMENDMENT"."B_OCCUR" = '1' ) AND
    ( "EN_AMENDMENT"."NROCCUR" = (select max(a.nroccur) from en_amendment A where A.f_contract="EN_CONTRACT"."ROW_ID" and A.b_occur='1') ) )
    It seems that the last condition of the where clause is the problem.
    How can it be faster ?
    Thank for your help,
    Fabrice
    null

    Try the following
    SELECT
    "EN_PERSON"."NAME",
    "EN_PERSON"."FIRSTNAMES",
    "EN_CONTRACT"."NRWORKER",
    "EN_AMENDMENT"."NROCCUR",
    "EN_AMENDMENT"."ENTRYDATE",
    "EN_AMENDMENT"."OUTDATE",
    "EN_CONTRACT"."ROW_ID",
    "EN_CONTRACT"."F_PAYGROUP",
    "EN_CONTRACT"."F_DEPARTMENT",
    "EN_CONTRACT"."F_EMPLOYER",
    "EN_AMENDMENT"."ROW_ID",
    "EN_PERSON"."ROW_ID",
    "EN_EMPLOYER"."DOSSIER",
    "EN_AMENDMENT"."NR_CT_AM",
    "EN_AMENDMENT"."F_TIMEGRID"
    FROM
    "EN_AMENDMENT",
    "EN_CONTRACT",
    "EN_PERSON",
    "EN_EMPLOYER" ,
    (select max(nroccur) maxdate
    from en_amendment
    where
    A.f_contract="EN_CONTRACT"."ROW_ID" and
    A.b_occur='1') A
    WHERE
    "EN_PERSON"."ROW_ID" = EN_CONTRACT"."F_PERSON" and
    "EN_CONTRACT"."ROW_ID" = "EN_AMENDMENT"."F_CONTRACT" and
    "EN_CONTRACT"."F_EMPLOYER" = "EN_EMPLOYER"."ROW_ID" and
    "EN_AMENDMENT"."B_OCCUR" = '1' ) AND
    "EN_AMENDMENT"."NROCCUR" = a.maxdate
    Using the inline view (subquery in the from clause with an alias)
    instead of the original correlated subquery in the where clause, allows
    it to use the subquery as if it were a table and use the join conditions similarly,
    eliminating the back and forth comparisons. Therefore, in general, it tends to be
    faster. Indexes on the datecolumn for each table would also tend to help. This
    may or may not be all that is needeed.
    null

  • I inadvertently speeded up the dialog of a book I am listening to and don't know how to reach the screen that says slower;normal; faster

    I inadvertently speeded up the dialog of a book I am listening to on my nano by selecting faster when I turned it off.  Now I can't return it to normal as I don't know how to get those selections up again: slower, normal, faster.  Can you help me?

    See your iPod's user guide for assistance.
    http://manuals.info.apple.com/en_US/iPod_nano_6thgen_User_Guide.pdf
    B-rock

Maybe you are looking for

  • How to get the GP Denpedencies(API) for NWDS CE7.1 EHP1

    Hi Frndz... I have 3 Qun's.. 1) How to get GP API in EHP1 NWDS7.1 in NWDS 7.0 we can get by D/L gp_api_nw04s.zip,gp_TopLevelDCs.zip and xtracting these to Location to Extract gp_api_nw04s.zip=> C:\Program Files\SAP\IDE\IDE70\eclipse\plugins\com.sap.t

  • CUPS 1.2.8

    I noticed that the version of CUPS on my Tiger system is 1.1 whereas the current version available at cups.org is 1.2.8. CUPS 1.2 has reportedly over 90 changes and new features although I am unsure how relevant these will be for me. Since I can prin

  • Itunes store just hangs and doesn't load

    , but i don't get any error messages.  I've already tried reinstalling and I also checked my firewall to make sure it isn't interfering, but no use.  Any advice?

  • PFsense in Hyper-V r2

    I am thinking to setup Pfsense in my network as firewall. but i have already setup my virtual network and don't want to change. but Pfsense needs Legacy network adapter in that case what should i do. is it good option to remove TMG2010 and put PFSENS

  • I cannot de ORF formaat with bridge  Wath can I do?

    I cannot de ORF formaat with bridge  Wath can I do?