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

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.

  • 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 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

  • A very slow select with sub selects sql statement on Oracle

    Hi,
    I'm moving an application from MySql to Oracle. The following select were very efficiently executed in MySql. In oracle its slow like a snail.
    Do anyone have a hint on how to speed it up?
    The slow part is the four sub selects in the select part. Removing them makes the select about 50 times faster on Oracle.
    Best Regards,
    Stephane
    select
    (select count(*) from relation rr where rr.document_id = d.id and rr.product_id = ? and (rr.relation_type_id = 'link' OR rr.relation_type_id = 'product')) as relationList,
    (select count(*) from relation rr where rr.document_id = d.id and rr.product_id = ? and rr.relation_type_id = 'number') as relationNumber,
    (select count(*) from relation rr where rr.document_id = d.id and rr.product_id = ? and rr.relation_type_id = 'title') as relationTitle,
    (select count(*) from relation rr where rr.document_id = d.id and rr.product_id = ? and rr.relation_type_id = 'content') as relationText,
    d.*
    from document d,(
    select distinct r.document_id id
    from relation r
    where
    r.product_id = ?
    ) dd
    where d.id=dd.id

    You are accessing the relation-table too many times, so a rewrite to a query like this
    SQL> select dept.deptno
      2       , dept.dname
      3       , count(decode(job,'CLERK',1)) clerk
      4       , count(decode(job,'MANAGER',1)) manager
      5       , count(decode(job,'SALESMAN',1)) salesman
      6    from dept, emp
      7   where dept.deptno = emp.deptno (+)
      8   group by dept.deptno
      9       , dept.dname
    10  /
        DEPTNO DNAME               CLERK    MANAGER   SALESMAN
            10 ACCOUNTING              1          1          0
            20 RESEARCH                2          1          0
            30 SALES                   1          1          4
            40 OPERATIONS              0          0          0
    4 rijen zijn geselecteerd.will be worth the effort.
    If still not satisfied, you have to do some investigation, as described [url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]here
    Regards,
    Rob.

  • Count is very slow

    table Structure is
    ID bigint primary key,
    Name Nvarchar(50)
    record 50 millions
    Query SQL
    SELECT COUNT(ID) FROM U WHERE Name = '';
    Query Time: over 3 minute
    First time is very slow
    How is Fast in first time???

    Have you tried  the below
    CREATE
    NONCLUSTERED
    INDEX
    idx ON
    Table1 (ID)
    INCLUDE (Name)
    WHERE
    Name='';
    GO
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • The problem is with the new operating system  and sending photo via email when used in my iPad.   From photo I selected 3 photos to send via email. I choose the upload key and choose to send by email. Typing text on the email is very slow.

    The problem is with the new operating system  and sending photo via email when used in my iPad.
    From photo I selected 3 photos to send via email. I choose the upload key and choose to send by email. Typing text on the email is very slow. This is solved by saving the email as a draft and opening the email again from mail.
    Can you amend he system to allow emails to be sent from photo as previously.

    Have you tried restarting or resetting your iPad?
    Restart: Press On/Off button until the Slide to Power Off slider appears, select Slide to Power Off and, after the iPad shuts down, then press the On/Off button until the Apple logo appears.
    Reset: Press the Home and On/Off buttons at the same time and hold them until the Apple logo appears (about 10 seconds). Ignore the "Slide to power off"

  • Very slow Sub Select Query

    Oracle Version 9.2.0.7.0
    Sorry to ask what is probably a stupid question that only serves to highlight how useless my SQL is!
    I have this SQL which counts total requisition lines, and then counts how many of those lines have converted to Sales Orders:
    SELECT prha.segment1
         , (SELECT COUNT(*)
              FROM po.po_requisition_lines_all prla
             WHERE prla.requisition_header_id = prha.requisition_header_id)
                                                                      req_line_ct
         , (SELECT COUNT(*)
              FROM po.po_requisition_lines_all prla
                 , ont.oe_order_lines_all sol
             WHERE prla.requisition_line_id = sol.source_document_line_id
               AND prla.requisition_header_id = prha.requisition_header_id)
                                                                       so_line_ct
      FROM po.po_requisition_headers_all prha
    WHERE  prha.creation_date >= '03-JUL-2008';The SQL works, but it is really, really slow. Is that just because it is running through lots and lots of data?
    If I comment out the 2nd Count SELECT, it runs immediately. Perhaps it is so slow because the join between the po_requisition_lines_all and the oe_order_lines_all table is not via primary keys. Also, there is not an index on the oe_order_lines_all table related to the source_document_line_id field.
    I'm sorry I haven't provided the full table designs for the tables involved - but the primary keys joining the requisition tables = via the requisition_headers_all table, and the join via the po_requisition_lines_all and the oe_order_lines_all table is not via a primary key or an index.
    Sorry once again, for probably talking nonsense.

    Please note this is a untested code as you didn't provide any of the required information like
    a) Test Data
    b) Relationship between the tables
    You could try something like this. But as already @someoneelse suggested it is definitely worth reading the link.
    select prha.segment1, count(case when prla.requisition_header_id is not null then 1 end) req_line_ct,
    count(case when sol.source_document_line_id is not null then 1 end) so_line_ct
    from
    po.po_requisition_header_all prha,
    po.po_requisition_lines_all prla,
    ont.oe_order_lines_all sol
    where
    prha.creation_date >= to_date('03.07.2008','dd.mm.yyyy')
    and
    prha.requisition_header_id = prla.requisition_header_id (+)
    and
    prla.requsition_line_id = sol.source_document_line_id (+)
    group by prha.segment1;Regards
    Raj

  • Very slow select query-

    Hi Guys,
    First of all apologies for the long post…
    I have written a query to fetch some data but it’s really slow…
    SELECT di.doc_no       doc_no,
           di.doc_class    doc_class,
           di.doc_sheet    doc_sheet,
           di.doc_rev      doc_rev
    FROM  dia_table di, pi_table pi
    WHERE pi.user_id = 'alain'
    AND   (1 IN (SELECT 1
                 FROM   spg_table s, ur_table r
                 WHERE  r.identity     = pi.user_id
                 AND    r.role         = s.role
                 AND    s.privilege_id = 'ADMINISTRATOR' )
    OR ( (di.edit_access = 1 OR di.view_access = 1) AND  di.person_id = pi.person_id )
    OR ( (di.edit_access = 1 OR di.view_access = 1) AND (di.person_id   = '*') )
    OR ( (di.edit_access = 1 OR di.view_access = 1) AND (di.group_id IS NOT NULL)
          AND
         (1 IN   (SELECT 1 
                  FROM   dgm_table  
                  WHERE  group_id = di.group_id 
                  AND  ( person_id = pi.person_id OR person_id = '*' ) ) )
         )This will take more than 3 hours to run…
    dia_table - 1400000 records
    pi_table - 2500 records
    spg_table - 20 records
    ur_table - 12000 records
    dgm_table - 1500 records
    Can you please advice on what kind of modifications that I could do to improve the above query…
    To get an idea I have the following results also…
    1.
    SELECT count(*)
    FROM  dia_table di, pi_table pi
    WHERE di.doc_no LIKE '10012%';
    If I run the above query (with out the where clause and with a extra condition to reduce the time to execute the query) it will return 481381 records within 4 seconds.
    2.
    SELECT count(*)
    FROM  dia_table di, pi_table pi
    WHERE pi.user_id = 'alain'
    AND   (1 IN (SELECT 1
                 FROM   spg_table s, ur_table r
                 WHERE  r.identity     = pi.user_id
                 AND    r.role         = s.role
                 AND    s.privilege_id = 'ADMINISTRATOR' )
    OR ( (di.edit_access = 1 OR di.view_access = 1) AND  di.person_id = pi.person_id )
    OR ( (di.edit_access = 1 OR di.view_access = 1) AND (di.person_id   = '*') )
    OR ( (di.edit_access = 1 OR di.view_access = 1) AND (di.group_id IS NOT NULL) )
    AND di.doc_no LIKE '10012%';
    This will return 241999 records within135 seconds. (Without the final AND clause)
    3.
    SELECT count(*)
    FROM  dia_table di, pi_table pi
    WHERE pi.user_id = 'alain'
    AND   (1 IN (SELECT 1
                 FROM   spg_table s, ur_table r
                 WHERE  r.identity     = pi.user_id
                 AND    r.role         = s.role
                 AND    s.privilege_id = 'ADMINISTRATOR' )
    OR ( (di.edit_access = 1 OR di.view_access = 1) AND  di.person_id = pi.person_id )
    OR ( (di.edit_access = 1 OR di.view_access = 1) AND (di.person_id   = '*') )
    OR ( (di.edit_access = 1 OR di.view_access = 1) AND (di.group_id IS NOT NULL)
          AND
         (1 IN   (SELECT 1 
                  FROM   dgm_table  
                  WHERE  group_id = di.group_id 
                  AND  ( person_id = pi.person_id OR person_id = '*' ) ) )
    AND di.doc_no LIKE '10012%';
    This will return 32299 records in 461 seconds. The extra condition (AND di.doc_no LIKE '10012%') was used to reduce the overall time taken so that I could see the execution times more quickly.I really appreciate any help/comments/advices you guys can provide…

    Hi... hope this will be a help to provide a suggestion…
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 2456893396
    | Id  | Operation                      | Name                      | Rows  | Byt
    |   0 | SELECT STATEMENT               |                           |  1332K|
    |   1 |  CONCATENATION                 |                           |       |
    |*  2 |   FILTER                       |                           |       |
    |   3 |    MERGE JOIN CARTESIAN        |                           |   517 | 284
    |*  4 |     TABLE ACCESS BY INDEX ROWID| DIA_TABLE                 |     1 |
    |*  5 |      INDEX RANGE SCAN          | DIA_PK                    |     1 |
    |   6 |     BUFFER SORT                |                           |  2393 | 263
    |   7 |      TABLE ACCESS FULL         | PI_TABLE                  |  2393 | 263
    |   8 |    INLIST ITERATOR             |                           |       |
    |*  9 |     INDEX RANGE SCAN           | DGM_PK                    |     1 |
    |* 10 |   FILTER                       |                           |       |
    |  11 |    MERGE JOIN CARTESIAN        |                           |   897 | 493
    |* 12 |     TABLE ACCESS FULL          | DIA_TABLE                 |     1 |
    |  13 |     BUFFER SORT                |                           |  2393 | 263
    |  14 |      TABLE ACCESS FULL         | PI_TABLE                  |  2393 | 263
    PLAN_TABLE_OUTPUT
    |  15 |    INLIST ITERATOR             |                           |       |
    |* 16 |     INDEX RANGE SCAN           | DGM_PK                    |     1 |
    |* 17 |   FILTER                       |                           |       |
    |* 18 |    HASH JOIN                   |                           | 46630 |  25
    |  19 |     TABLE ACCESS FULL          | PI_TABLE                  |  2393 | 263
    |* 20 |     TABLE ACCESS FULL          | DIA_TABLE                 |   139K|  60
    |  21 |    INLIST ITERATOR             |                           |       |
    |* 22 |     INDEX RANGE SCAN           | DGM_PK                    |     1 |
    |* 23 |   FILTER                       |                           |       |
    |  24 |    NESTED LOOPS                |                           | 64224 |  34
    |  25 |     TABLE ACCESS BY INDEX ROWID| PI_TAB                    |     1 |
    |* 26 |      INDEX UNIQUE SCAN         | USER_ID_UX                |     1 |
    |  27 |       NESTED LOOPS             |                           |     1 |
    |* 28 |        INDEX FULL SCAN         | SYSTEM_PRIVILEGE_GRANT_PK |     1 |
    |* 29 |        INDEX UNIQUE SCAN       | FND_USER_ROLE_RUNTIME_PK  |     1 |
    |* 30 |     TABLE ACCESS FULL          | DIA_TABLE                 |  1284K|
    |  31 |    INLIST ITERATOR             |                           |       |
    |* 32 |     INDEX RANGE SCAN           | DGM_PK                    |     1 |
    --------------------------------------------------------------------------------Edited by: Napster on Oct 20, 2009 1:13 AM

  • [11g R2] Update-Select with BITMAP CONVERSION TO ROWIDS = very slow

    Hi all,
    I have to deal with some performance issues in our database.
    The query below takes between 30 minutes and 60 minutes to complete (30 minutes during the batch process and 1h when I executed the query with SQLPLUS):
    SQL_ID  4ky65wauhg1ub, child number 0
    UPDATE fiscpt x    SET (x.cimld) =           (SELECT COUNT (*)         
        FROM fiscpt f             WHERE f.comar = x.comar               AND
    f.coint = x.coint               AND f.nucpt = x.nucpt               AND
    f.codev != x.codev               AND f.cimvt != 0)  WHERE x.comar IN
    ('CBOT', 'CME', 'EUREX', 'FOREX', 'LIFFE', 'METAL', 'OCC')
    Plan hash value: 697684605
    | Id  | Operation                          | Name    | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
    |   0 | UPDATE STATEMENT                   |         |      1 |        |       |   773K(100)|          |      0 |00:22:22.30 |      36M|   7629 |       |       |          |
    |   1 |  UPDATE                            | FISCPT  |      1 |        |       |            |          |      0 |00:22:22.30 |      36M|   7629 |       |       |          |
    |   2 |   INLIST ITERATOR                  |         |      1 |        |       |            |          |    179K|00:00:00.37 |    1221 |      3 |       |       |          |
    |*  3 |    INDEX RANGE SCAN                | FISCPT1 |      7 |    154K|  4984K|     5   (0)| 00:00:01 |    179K|00:00:00.23 |    1221 |      3 |       |       |          |
    |   4 |   SORT AGGREGATE                   |         |    179K|      1 |    33 |            |          |    179K|01:02:58.45 |      35M|   3020 |       |       |          |
    |*  5 |    TABLE ACCESS BY INDEX ROWID     | FISCPT  |    179K|      1 |    33 |     4  (25)| 00:00:01 |  63681 |01:02:57.80 |      35M|   3020 |       |       |          |
    |   6 |     BITMAP CONVERSION TO ROWIDS    |         |    179K|        |       |            |          |    121K|01:02:52.71 |      35M|    885 |       |       |          |
    |   7 |      BITMAP AND                    |         |    179K|        |       |            |          |  87091 |01:02:52.25 |      35M|    885 |       |       |          |
    |   8 |       BITMAP CONVERSION FROM ROWIDS|         |    179K|        |       |            |          |    179K|00:00:03.31 |     241K|      0 |       |       |          |
    |*  9 |        INDEX RANGE SCAN            | FISCPT2 |    179K|   1547 |       |     1   (0)| 00:00:01 |   1645K|00:00:02.23 |     241K|      0 |       |       |          |
    |  10 |       BITMAP CONVERSION FROM ROWIDS|         |    179K|        |       |            |          |    148K|01:02:44.98 |      35M|    885 |       |       |          |
    |  11 |        SORT ORDER BY               |         |    179K|        |       |            |          |   2412M|00:52:19.70 |      35M|    885 |  1328K|   587K| 1180K (0)|
    |* 12 |         INDEX RANGE SCAN           | FISCPT1 |    179K|   1547 |       |     2   (0)| 00:00:01 |   2412M|00:22:11.22 |      35M|    885 |       |       |          |
    Query Block Name / Object Alias (identified by operation id):
       1 - UPD$1
       3 - UPD$1 / X@UPD$1
       4 - SEL$1
       5 - SEL$1 / F@SEL$1
    Predicate Information (identified by operation id):
       3 - access(("X"."COMAR"='CBOT' OR "X"."COMAR"='CME' OR "X"."COMAR"='EUREX' OR "X"."COMAR"='FOREX' OR "X"."COMAR"='LIFFE' OR "X"."COMAR"='METAL' OR
                  "X"."COMAR"='OCC'))
       5 - filter("F"."CIMVT"<>0)
       9 - access("F"."COINT"=:B1 AND "F"."NUCPT"=:B2)
      12 - access("F"."COMAR"=:B1)
           filter(("F"."CODEV"<>:B1 AND "F"."COMAR"=:B2))
    Column Projection Information (identified by operation id):
       2 - (upd=6; cmp=2,3,4,5) "SYS_ALIAS_4".ROWID[ROWID,10], "X"."COMAR"[VARCHAR2,5], "X"."COINT"[VARCHAR2,11], "X"."NUCPT"[VARCHAR2,8], "X"."CODEV"[VARCHAR2,3],
           "X"."CIMLD"[NUMBER,22]
       3 - "SYS_ALIAS_4".ROWID[ROWID,10], "X"."COMAR"[VARCHAR2,5], "X"."COINT"[VARCHAR2,11], "X"."NUCPT"[VARCHAR2,8], "X"."CODEV"[VARCHAR2,3], "X"."CIMLD"[NUMBER,22]
       4 - (#keys=0) COUNT(*)[22]
       5 - "F".ROWID[ROWID,10], "F"."COMAR"[VARCHAR2,5], "F"."COINT"[VARCHAR2,11], "F"."NUCPT"[VARCHAR2,8], "F"."CODEV"[VARCHAR2,3], "F"."CIMVT"[NUMBER,22]
       6 - "F".ROWID[ROWID,10]
       7 - STRDEF[BM VAR, 10], STRDEF[BM VAR, 10], STRDEF[BM VAR, 32496]
       8 - STRDEF[BM VAR, 10], STRDEF[BM VAR, 10], STRDEF[BM VAR, 32496]
       9 - "F".ROWID[ROWID,10]
      10 - STRDEF[BM VAR, 10], STRDEF[BM VAR, 10], STRDEF[BM VAR, 32496]
      11 - (#keys=1) "F".ROWID[ROWID,10]
      12 - "F".ROWID[ROWID,10]
    Note
       - dynamic sampling used for this statement (level=2)We intentionally don't gather statistics on the FISCPT table.
    There are no indexes on the column updated so the slowness is not due to updating of indexes:
    SQL> select index_name, column_name from user_ind_columns where table_name='FISCPT';
    INDEX_NAME COLUMN_NAM
    FISCPT1    NUCPT
    FISCPT1    CODEV
    FISCPT1    RGCID
    FISCPT1    DATRA
    FISCPT2    COINT
    FISCPT2    NUCPT
    FISCPT3    NUFIS
    FISCPT1    COINT
    FISCPT1    COMAR
    9 ligne(s) sÚlectionnÚe(s).
    SQL> select count(1) from FISCPT;
      COUNT(1)
        179369If I replace the UPDATE-SELECT statement by a SELECT, the query runs in few seconds:
    SQL>  SELECT COUNT (*)
      2               FROM fiscpt f, fiscpt x
      3              WHERE f.comar = x.comar
      4                AND f.coint = x.coint
      5                AND f.nucpt = x.nucpt
      6                AND f.codev != x.codev
      7                AND f.cimvt != 0
      8   and x.comar IN ('CBOT', 'CME', 'EUREX', 'FOREX', 'LIFFE', 'METAL', 'OCC');
      COUNT(*)
         63681
    EcoulÚ : 00 :00 :00.75
    SQL> select * from table(dbms_xplan.display_cursor());
    PLAN_TABLE_OUTPUT
    SQL_ID  5drbpdmdv0gv1, child number 0
    SELECT COUNT (*)              FROM fiscpt f, fiscpt x
    WHERE f.comar = x.comar               AND f.coint = x.coint
      AND f.nucpt = x.nucpt               AND f.codev != x.codev
       AND f.cimvt != 0  and x.comar IN ('CBOT', 'CME', 'EUREX', 'FOREX',
    'LIFFE', 'METAL', 'OCC')
    Plan hash value: 1326101771
    | Id  | Operation                      | Name    | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |         |       |       |       |  2477 (100)|          |
    |   1 |  SORT AGGREGATE                |         |     1 |    53 |       |            |          |
    |*  2 |   HASH JOIN                    |         |   107K|  5557K|  4720K|  2477   (1)| 00:00:30 |
    |   3 |    INLIST ITERATOR             |         |       |       |       |            |          |
    |*  4 |     TABLE ACCESS BY INDEX ROWID| FISCPT  |   107K|  3460K|       |  1674   (1)| 00:00:21 |
    |*  5 |      INDEX RANGE SCAN          | FISCPT1 |   154K|       |       |   873   (0)| 00:00:11 |
    |*  6 |    INDEX FAST FULL SCAN        | FISCPT1 |   154K|  3021K|       |   337   (0)| 00:00:05 |
    Predicate Information (identified by operation id):
       2 - access("F"."COMAR"="X"."COMAR" AND "F"."COINT"="X"."COINT" AND
                  "F"."NUCPT"="X"."NUCPT")
           filter("F"."CODEV"<>"X"."CODEV")
       4 - filter("F"."CIMVT"<>0)
       5 - access(("F"."COMAR"='CBOT' OR "F"."COMAR"='CME' OR "F"."COMAR"='EUREX' OR
                  "F"."COMAR"='FOREX' OR "F"."COMAR"='LIFFE' OR "F"."COMAR"='METAL' OR "F"."COMAR"='OCC'))
       6 - filter(("X"."COMAR"='CBOT' OR "X"."COMAR"='CME' OR "X"."COMAR"='EUREX' OR
                  "X"."COMAR"='FOREX' OR "X"."COMAR"='LIFFE' OR "X"."COMAR"='METAL' OR "X"."COMAR"='OCC'))
    Note
       - dynamic sampling used for this statement (level=2)The optimizer parameters are at their default values.
    The database is an 11.2.0.1 and the OS is a Linux Red hat.
    can someone help me to tune this query please?

    Thanks Tubby for your reply,
    We don't gather statistics at all on this table because it's a process table: on the production database we may have several processes which insert/delet/update rows into this table so we prefer to rely on Dynamic Sampling instead of gathering statistics each time a process need to access this table.
    I don't dynamic sampling is the problem here because when i use the level 10 the execution plan is the same:
    SQL> alter session set optimizer_dynamic_sampling=10;
    Session modifiÚe.
    EcoulÚ : 00 :00 :00.00
    SQL> explain plan for
      2  UPDATE fiscpt x
      3     SET (x.cimld) =
      4            (SELECT COUNT (*)
      5               FROM fiscpt f
      6              WHERE f.comar = x.comar
      7                AND f.coint = x.coint
      8                AND f.nucpt = x.nucpt
      9                AND f.codev != x.codev
    10                AND f.cimvt != 0)
    11   WHERE x.comar IN ('CBOT', 'CME', 'EUREX', 'FOREX', 'LIFFE', 'METAL', 'OCC');
    ExplicitÚ.
    EcoulÚ : 00 :00 :01.04
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 697684605
    | Id  | Operation                          | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | UPDATE STATEMENT                   |         |   179K|  5780K|   896K (20)| 02:59:23 |
    |   1 |  UPDATE                            | FISCPT  |       |       |            |          |
    |   2 |   INLIST ITERATOR                  |         |       |       |            |          |
    |*  3 |    INDEX RANGE SCAN                | FISCPT1 |   179K|  5780K|     5   (0)| 00:00:01 |
    |   4 |   SORT AGGREGATE                   |         |     1 |    33 |            |          |
    |*  5 |    TABLE ACCESS BY INDEX ROWID     | FISCPT  |     1 |    33 |     4  (25)| 00:00:01 |
    |   6 |     BITMAP CONVERSION TO ROWIDS    |         |       |       |            |          |
    |   7 |      BITMAP AND                    |         |       |       |            |          |
    |   8 |       BITMAP CONVERSION FROM ROWIDS|         |       |       |            |          |
    |*  9 |        INDEX RANGE SCAN            | FISCPT2 |  1794 |       |     1   (0)| 00:00:01 |
    |  10 |       BITMAP CONVERSION FROM ROWIDS|         |       |       |            |          |
    |  11 |        SORT ORDER BY               |         |       |       |            |          |
    |* 12 |         INDEX RANGE SCAN           | FISCPT1 |  1794 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - access("X"."COMAR"='CBOT' OR "X"."COMAR"='CME' OR "X"."COMAR"='EUREX' OR
                  "X"."COMAR"='FOREX' OR "X"."COMAR"='LIFFE' OR "X"."COMAR"='METAL' OR
                  "X"."COMAR"='OCC')
       5 - filter("F"."CIMVT"<>0)
       9 - access("F"."COINT"=:B1 AND "F"."NUCPT"=:B2)
      12 - access("F"."COMAR"=:B1)
           filter("F"."CODEV"<>:B1 AND "F"."COMAR"=:B2)
    Note
       - dynamic sampling used for this statement (level=10)I have tested the query you provided and the execution plan is almost the same (A FILTER clause is added but the COST isthe same):
    SQL> explain plan for
      2  UPDATE   fiscpt x
      3     SET (x.cimld) =
      4            (SELECT  COUNT (*)
      5               FROM fiscpt f
      6              WHERE f.comar = x.comar
      7                AND f.coint = x.coint
      8                AND f.nucpt = x.nucpt
      9                AND f.codev != x.codev
    10                AND f.cimvt != 0
    11                and   f.comar IN ('CBOT', 'CME', 'EUREX', 'FOREX', 'LIFFE', 'METAL', 'OCC')
    12                )
    13   WHERE x.comar IN ('CBOT', 'CME', 'EUREX', 'FOREX', 'LIFFE', 'METAL', 'OCC');
    ExplicitÚ.
    EcoulÚ : 00 :00 :00.01
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1565986742
    | Id  | Operation                           | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | UPDATE STATEMENT                    |         |   154K|  4984K|   773K (20)| 02:34:41 |
    |   1 |  UPDATE                             | FISCPT  |       |       |            |          |
    |   2 |   INLIST ITERATOR                   |         |       |       |            |          |
    |*  3 |    INDEX RANGE SCAN                 | FISCPT1 |   154K|  4984K|     5   (0)| 00:00:01 |
    |   4 |   SORT AGGREGATE                    |         |     1 |    33 |            |          |
    |*  5 |    FILTER                           |         |       |       |            |          |
    |*  6 |     TABLE ACCESS BY INDEX ROWID     | FISCPT  |     1 |    33 |     4  (25)| 00:00:01 |
    |   7 |      BITMAP CONVERSION TO ROWIDS    |         |       |       |            |          |
    |   8 |       BITMAP AND                    |         |       |       |            |          |
    |   9 |        BITMAP CONVERSION FROM ROWIDS|         |       |       |            |          |
    |* 10 |         INDEX RANGE SCAN            | FISCPT2 |  1547 |       |     1   (0)| 00:00:01 |
    |  11 |        BITMAP CONVERSION FROM ROWIDS|         |       |       |            |          |
    |  12 |         SORT ORDER BY               |         |       |       |            |          |
    |* 13 |          INDEX RANGE SCAN           | FISCPT1 |  1547 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - access("X"."COMAR"='CBOT' OR "X"."COMAR"='CME' OR "X"."COMAR"='EUREX' OR
                  "X"."COMAR"='FOREX' OR "X"."COMAR"='LIFFE' OR "X"."COMAR"='METAL' OR "X"."COMAR"='OCC')
       5 - filter(:B1='CBOT' OR :B2='CME' OR :B3='EUREX' OR :B4='FOREX' OR :B5='LIFFE' OR
                  :B6='METAL' OR :B7='OCC')
       6 - filter(("F"."COMAR"='CBOT' OR "F"."COMAR"='CME' OR "F"."COMAR"='EUREX' OR
                  "F"."COMAR"='FOREX' OR "F"."COMAR"='LIFFE' OR "F"."COMAR"='METAL' OR
                  "F"."COMAR"='OCC') AND "F"."CIMVT"<>0)
      10 - access("F"."COINT"=:B1 AND "F"."NUCPT"=:B2)
      13 - access("F"."COMAR"=:B1)
           filter("F"."CODEV"<>:B1 AND ("F"."COMAR"='CBOT' OR "F"."COMAR"='CME' OR
                  "F"."COMAR"='EUREX' OR "F"."COMAR"='FOREX' OR "F"."COMAR"='LIFFE' OR
                  "F"."COMAR"='METAL' OR "F"."COMAR"='OCC') AND "F"."COMAR"=:B2)
    Note
       - dynamic sampling used for this statement (level=2)I have executed this statement for 50 minutes and it is still running now
    Furthermore, I have used the tuning advisor but it has not found any recommendation.
    is it normal that oracle takes 1hour to update 175k rows?

  • Same select max is very slow in one program but fast in another

    Hi,
    I have a report that becomes very slow these few months. I used SQL trace for the report and found out its these codes that slow down the report:
    SELECT MAX( mkpf~budat )
                  FROM mkpf
        INNER JOIN mseg
                       ON mseg~mblnr = mkpf~mblnr AND mseg~mjahr = mkpf~mjahr
                    INTO posting_date
               WHERE mseg~werks  = w_matl-batch_reservations-werks
                     AND mseg~charg  = w_matl-batch_reservations-charg
                     AND mseg~bwart  IN ('261', 'Z61').
    The thing is these codes have been used in different system, DEV, QAS, and PRD. But only in PRD it is very slow, other systems are pretty fast.
    I even created a local copy of that report in PRD, with the same code. The local file runs fast and perfectly. But the original code is just slow.
    Just wondering if anybody met this problem too? any ideas??

    Hi Liu,
    Index creation is not a advisable solution.Please follow the existing indexes by adding Mandt field.
    Try like this
    SELECT MAX( mkpf~budat )
                  FROM mkpf
        INNER JOIN mseg
                       ON mseg~mblnr = mkpf~mblnr AND mseg~mjahr = mkpf~mjahr
                    INTO posting_date
               WHERE mseg~mandt = sy-mandt
                      AND mkpf~mandt = sy-mandt
                      AND mseg~werks  = w_matl-batch_reservations-werks
                     AND mseg~charg  = w_matl-batch_reservations-charg
                     AND mseg~bwart  IN ('261', 'Z61').
    Hope it will be helpful.
    Regards,
    Kannan

  • My Photoshop CS3 goes very slow/choppy when I have a selection made.

    Hello,
    My Photoshop CS3 goes very slow/choppy when I have a selection made, with those little moving lines indicating the selection (the lines that look like walking ants). When I'm adding to the selection, it's fine again, because the "ants" aren't moving, same with when I hit Q to enter Quick Mask Mode--as long as the "ants" aren't moving, my Photoshop isn't slow. Is there any way to fix this? To either speed up Photoshop or to stop the "ants" from moving, and simply allow selections to be indicated by broken lines, but not moving broken lines?
    Thanks

    Operating System: Windows 7 Ultimate 32-bit (6.1, Build 7600) (7600.win7_rtm.090713-1255)
               Language: English (Regional Setting: English)
    System Manufacturer: Tyan Computer Corporation
           System Model: S2668 Tiger i7505              
                   BIOS: PhoenixBIOS 4.0 Release 6.0    
              Processor: Intel(R) Xeon(TM) CPU 3.06GHz (4 CPUs), ~3.1GHz
                 Memory: 4096MB RAM
    Available OS Memory: 3072MB RAM
              Page File: 2548MB used, 3589MB available
    49.9 GB of 465 GB free.

  • Scrolling slow with initial marquee selection, but very fast when adding to selection

    I've found that when I zoom in and try to make a selection that requires me to scroll beyond the viewable area, the scrolling becomes very slow when I scroll down. And if I add to the selection (via shift) the scroll becomes very fast, as if the shift key nudges the screen by x number of pixels, just as if I were to shift-move a layer. Is this the intended behavior?

    Ramon, my apologies. I own a MacBook Pro running OS 10.5.6, 2.4 GHz prcoessor with 2 GB of RAM, and 256 MB of VRAM. I'm using Photoshop CS4.
    So I ran a couple tests and I think I know what's occurring. The scroll speed seems dependent on how close or far the cursor is from the canvas edge (the axis in between the image and the scrollbar). So for example, if I were to do a max zoom the window would expand to the very edge of the desktop. When I start the marquee and move my cursor to scroll it's unable to move any further from the axis because of the desktop edge. This would cause it to scroll more slowly.
    Here are a couple of test vids (The zoom is at 3200% and I set up the camera to focus on the top right of the screen):
    Window right up against desktop edge (automatically positioned via Photoshop max zoom)
    http://s87.photobucket.com/albums/k156/darthsauce/mac/?action=view&current=horiz01.flv
    Window edge moved a little away from desktop edge
    http://s87.photobucket.com/albums/k156/darthsauce/mac/?action=view&current=horiz03.flv
    Window edge moved past the desktop edge (but axis is still visible)
    http://s87.photobucket.com/albums/k156/darthsauce/mac/?action=view&current=horiz00.flv
    Could this be considered an oversight in the design since zoom automatically resizes the window for us (of course, this would affect users differently depending on their zoom ratio and display resolution)? This means that I'll have to resize the window each time the zoom fills the desktop in order to scroll at a proper rate.

  • Selecting sidebar actions under Lion very slow

    Under Snow Leopard, when I would move between some sidebard items like iPhone, iPad, or the apps list, my system was very quick.  I synch my devices very frequently to keep my business calendar updated all the time so switching is happening all the time.
    Under Lion, the store, the library items, in the sidebard all switch very fast.  But selecting the iPhone, the iPad or the list of apps in the library is incredibly slow.  Timed, its 12 to 13 seconds every time they are selected before the change takes place.  I even get the spinning beachball every time.  And, same thing reselecting, its not just the first time.
    Is this unusual?  Any suggestions appreciated.  It just seems very unusual that this one app would have some specific things like this suddenly get so very slow.
    Thanks!

    Hello, the problem seems to be more specific about my use of mod_auth_kerb with apache. The authentication seems to take quite some time.
    Greetings,
    Michel

Maybe you are looking for

  • How do I get a license for Window Embedded CE 6.0 Platform Builder?

    I downloaded the Windows Embedded CE 6.0 Platform Builder for Visual Studio 2005, but the trial license is no longer available. How do I go about getting a license for this product? How much is it?

  • No response

    Hello, Have been trying to get some one from Verizon to respond to numerous emails sent. Has any one ever got any response from Verizon? Chat seems to be down all the time. (I was not surprised) The ordering service feature from the the web seems to

  • Cross database join Oracle - SQL server date column - nQSError: 46008

    Hi, I am using OBIEE 10.1.3.4.2 and I am able to make cross database join between Oracle and SQL server using varchar columns, but I am getting this error: nQSError:22024-A comparison is being carried out between noncompatible type when I try to make

  • Change the time zone in Java System only

    Hi there, Does anyone knows where to change the time zone in Java system only? I know in ABAP they have t-code: STZAC? where do I change in Java? Configtool or visual admin? what is the service name or parameter for this? Thanks Kumar

  • Finding intial context factory for java naming connect to DS5

    I'm a newbie to LDAP programming using the JNDI interfaces to connect to my DS 5 implementation. I can't seem to find any reference as to where the correct factory for the initialDirContext is! I need the factory classname for this call: env.put(Cont