Optimization bug

I am using the Flex Builder 2.01 Eclipse plugin on a MacBook
Pro. I have some code which takes an object tree and recursively
wraps all of the Array properties of objects to ArrayCollections.
So for example, the tree starts with an object Foo, which has a
bunch of properties on it. One of these properties could be an
Array. This Array property will be replaced by an ArrayCollection,
and then for each object in the array, the same process is
performed. Here is some example code:
public static function convertObject( o:Object ):Object
var classInfo:XML = describeType( o );
if ( [email protected]() == "Object" )
for ( var key:String in o )
var value:Object = o[key];
if ( value is Array )
o[key] = convertToArrayCollection( o, value as Array );
return o;
public static function convertToArrayCollection(
parent:Object, value:Array ):ArrayCollection
var arrayCollection:ArrayCollection = new ArrayCollection();
arrayCollection.source = value;
for ( var i:int = 0; i < value.length; i++ )
convertObject( value
, changeListener );
return ArrayCollection(arrayCollection);
So, when I use the default compiler settings in Flex Builder
2.01, this will intermittently fail. The behavior I get is that
when I iterate through the properties of the object I am
converting, some of the properties are not there, and other
properties are duplicated. So for example, if my object has these
properties:
foo
bar
myarray
When I iterate through all the properties, I get
foo
bar
foo
bar
instead of
foo
bar
myarray
I first tried to debug this issue, thinking there was some
problem with my code. But whenever I ran the debug version, I
didn't see the problem. Finally, under compiler options, I set
-debug=true and -optimize=false and the problem appears to have
went away. So, it appears that there is some problem with the
optimization in the compiler.

Thanks for confirming this.
No, this happens neither in an Open Source package nor in an important product. This is an internal product, which is continuously developed with Sun Tools since 1992 (with incidents like this one being very rare).
I am a bit concerned with this bug though, because it might indicate a weakness in the area of C++ inlining (after all, the compiler fails to correctly aggregate a sequence of three fairly simple inline functions, something which is quite common in our application). If, on the other hand, this is a singular failure caused by unique circumstances which we have hit by sheer (un)luck, it is always possible to work around this: explicitly defining a assignment operator instead of relying on the compiler-generated one is sufficient to make the bug go away.

Similar Messages

  • Optimization bug with C++ inlining

    Hi,
    While evaluating Sun Studio 11 I have identified an optimization bug with C++ inlining.
    The bug can easily be reproduced with the small program below. The program produces
    wrong results with -xO2, because an inline access function always returns the value 0.0
    instead of the value given on the commandline:
    djerba{ru}16 : CC -o polybug  polybug.cc
    djerba{ru}17 : ./polybug 1.0
    coeff(0): 1.000000
    djerba{ru}18 : CC -o polybug -xO2 polybug.cc
    djerba{ru}19 : ./polybug 1.0
    coeff(0): 0.000000            <<<<<<<<<< wrong, should be 1.000000This occurs only with optimization level O2; levels below or above O2 don't
    exhibit the bug.
    Compiler version is
    Sun C++ 5.8 Patch 121017-01 2005/12/11
    on Solaris 8 / Sparc.
    I include a preliminary analysis at the end.
    Best Regards
    Dieter R.
    -------------------- polybug.cc -------------------------
    // note: this may look strange, but this is a heavily stripped down
    // version of actual working application code...
    #include <stdio.h>
    #include <stdlib.h>
    class Poly {
      public:
        // constructor initializes number of valid coefficients to zero:
        Poly() { numvalid = 0; };
        ~Poly() {};
        // returns coefficient with index j, if valid. Otherwise returns 0.0:
        double coeff(int j) {
         if (j < numvalid) {
             return coefficients[j];
         } else {
             return 0.0;
       // copies contents of this Object to other Poly:
        void getPoly(Poly& q) { q = *this; };
        // data members:
        // valid coefficients: 0 ... (numvalid - 1)
        double coefficients[6];
        int numvalid;
    void troublefunc(Poly* pC) {
        // copies Poly-Object to local Poly, extracts coefficient
        // with index 0 and prints it. Should be the value given
        // on commandline.
        // Poly constructor, getPoly and coeff are all inline!
        if (pC) {
         Poly pol;                      
         pC->getPoly(pol);
         printf("coeff(0): %f\n",pol.coeff(0));
    int main(int argc,char* argv[]) {
        double d = atof(argv[1]);
        // creates Poly object and fills coefficient with index
        // 0 with the value given on commandline
        Poly* pC = new Poly;
        pC->coefficients[0] = d;
        pC->numvalid = 1;
        troublefunc(pC);   
        return 0;
    The disassembly fragment below shows that the access function coeff(0), instead
    of retrieving coefficient[0] simply returns the fixed value 0.0 (presumably because the
    optimizer "thinks" numvalid holds still the value 0 from the constructor and that therefore
    the comparison "if (i < numvalid)" can be omitted).
    Note: disassembly created from code compiled with -features=no%except for simplicity!
    00010e68 <___const_seg_900000102>:
            ...     holds the value 0.0
    00010e80 <__1cLtroublefunc6FpnEPoly__v_>:
       10e80:       90 90 00 08     orcc  %g0, %o0, %o0      if (pC) {   
       10e84:       02 40 00 14     be,pn   %icc, 10ed4
       10e88:       9c 03 bf 50     add  %sp, -176, %sp
                                                       local Poly object at %sp + 120
                                                             numvalid at %sp + 0xa8 (168)
       10e8c:       c0 23 a0 a8     clr  [ %sp + 0xa8 ]      Poly() { numvalid = 0; };
                                                             pC->getPoly(pol):
                                                             loop copies *pC to local Poly object
       10e90:       9a 03 a0 80     add  %sp, 0x80, %o5
       10e94:       96 10 20 30     mov  0x30, %o3
       10e98:       d8 5a 00 0b     ldx  [ %o0 + %o3 ], %o4
       10e9c:       96 a2 e0 08     subcc  %o3, 8, %o3
       10ea0:       16 4f ff fe     bge  %icc, 10e98
       10ea4:       d8 73 40 0b     stx  %o4, [ %o5 + %o3 ]
                                                             pol.coeff(0):
                                                             load double value 0.0 at
                                                             ___const_seg_900000102 in %f0
                                                             (and address of format string in %o0)
       10ea8:       1b 00 00 43     sethi  %hi(0x10c00), %o5
       10eac:       15 00 00 44     sethi  %hi(0x11000), %o2
       10eb0:       c1 1b 62 68     ldd  [ %o5 + 0x268 ], %f0
       10eb4:       90 02 a0 ac     add  %o2, 0xac, %o0
       10eb8:       82 10 00 0f     mov  %o7, %g1
                                                             store 0.0 in %f0 to stack and load it
                                                             from there to %o1/%o2
       10ebc:       c1 3b a0 60     std  %f0, [ %sp + 0x60 ]
       10ec0:       d2 03 a0 60     ld  [ %sp + 0x60 ], %o1
       10ec4:       d4 03 a0 64     ld  [ %sp + 0x64 ], %o2
       10ec8:       9c 03 a0 b0     add  %sp, 0xb0, %sp
                                                             call printf
       10ecc:       40 00 40 92     call  21114 <_PROCEDURE_LINKAGE_TABLE_+0x54>
       10ed0:       9e 10 00 01     mov  %g1, %o7
       10ed4:       81 c3 e0 08     retl
       10ed8:       9c 03 a0 b0     add  %sp, 0xb0, %sp
    Hmmm... This seems to stress this formatting tags thing to its limits...

    Thanks for confirming this.
    No, this happens neither in an Open Source package nor in an important product. This is an internal product, which is continuously developed with Sun Tools since 1992 (with incidents like this one being very rare).
    I am a bit concerned with this bug though, because it might indicate a weakness in the area of C++ inlining (after all, the compiler fails to correctly aggregate a sequence of three fairly simple inline functions, something which is quite common in our application). If, on the other hand, this is a singular failure caused by unique circumstances which we have hit by sheer (un)luck, it is always possible to work around this: explicitly defining a assignment operator instead of relying on the compiler-generated one is sufficient to make the bug go away.

  • Optimizer bug in RDBMS versions 9.2.0.7.0 and 9.2.0.8.0

    This listing below demonstrates a bug in the Oracle optimizer that causes incorrect results to be returned after a table is analyzed. Rule based optimizer gives correct results.
    Under cost-based optimization the predicate includes a condition from a check constraint on a nullable field. When the value of this field is NULL the record is excluded from the results even though that record does not violate the check constraint.
    I have verified that this bug exists on both RDBMS versions 9.2.0.7.0 and 9.2.0.8.0.
    ORA92080>
    ORA92080>DROP TABLE test1;
    Table dropped.
    ORA92080>DROP TABLE test2;
    Table dropped.
    ORA92080>
    ORA92080>CREATE TABLE test1
    2 ( id     NUMBER NOT NULL
    3 , date1     DATE NOT NULL
    4 , date2     DATE
    5 );
    Table created.
    ORA92080>
    ORA92080>ALTER TABLE test1
    2 ADD ( CONSTRAINT test1_chk_date1
    3      CHECK ( date1 > TO_DATE( '01-JAN-1960', 'DD-MON-YYYY' ) )
    4      );
    Table altered.
    ORA92080>
    ORA92080>ALTER TABLE test1
    2 ADD ( CONSTRAINT test1_chk_date2
    3      CHECK ( date2 >= date1 )
    4      );
    Table altered.
    ORA92080>
    ORA92080>/* date2 is NULL */
    ORA92080>INSERT INTO test1 VALUES ( 1, TO_DATE('16-JUN-2005 11:30:01', 'DD-MON-YYYY HH24:MI:SS'), NULL );
    1 row created.
    ORA92080>
    ORA92080>/* date2 is filled in */
    ORA92080>INSERT INTO test1 VALUES ( 2
    2                     , TO_DATE('16-JUN-2005 11:30:01', 'DD-MON-YYYY HH24:MI:SS')
    3                     , TO_DATE('16-JUN-2005 11:40:01', 'DD-MON-YYYY HH24:MI:SS')
    4                );
    1 row created.
    ORA92080>
    ORA92080>CREATE TABLE test2 AS
    2 SELECT * FROM test1
    3 WHERE 1=2;
    Table created.
    ORA92080>
    ORA92080>ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
    Session altered.
    ORA92080>
    ORA92080>SELECT * FROM test1;
    ID DATE1 DATE2
    1 16-JUN-2005 11:30:01
    2 16-JUN-2005 11:30:01 16-JUN-2005 11:40:01
    2 rows selected.
    ORA92080>SELECT * FROM test2;
    no rows selected
    ORA92080>
    ORA92080>/*
    DOC>| Since no statistics were gathered, rule-based optimizer will be used.
    DOC>| The correct count of two is returned.
    DOC>*/
    ORA92080>SELECT COUNT(*) FROM test1 t
    2 WHERE EXISTS
    3      ( SELECT 'X'
    4      FROM ( SELECT id, date1
    5                FROM test1
    6           MINUS
    7           SELECT id, date1
    8                FROM test2
    9           ) i
    10      WHERE i.id = t.id
    11           AND i.date1 = t.date1
    12      );
    COUNT(*)
    2
    1 row selected.
    ORA92080>
    ORA92080>EXPLAIN PLAN FOR
    2 SELECT COUNT(*) FROM test1 t
    3 WHERE EXISTS
    4      ( SELECT 'X'
    5      FROM ( SELECT id, date1
    6                FROM test1
    7           MINUS
    8           SELECT id, date1
    9                FROM test2
    10           ) i
    11      WHERE i.id = t.id
    12           AND i.date1 = t.date1
    13      );
    Explained.
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | | | |
    | 1 | SORT AGGREGATE | | | | |
    |* 2 | FILTER | | | | |
    | 3 | TABLE ACCESS FULL | TEST1 | | | |
    | 4 | VIEW | | | | |
    | 5 | MINUS | | | | |
    | 6 | SORT UNIQUE | | | | |
    |* 7 | TABLE ACCESS FULL| TEST1 | | | |
    | 8 | SORT UNIQUE | | | | |
    |* 9 | TABLE ACCESS FULL| TEST2 | | | |
    Predicate Information (identified by operation id):
    2 - filter( EXISTS (SELECT 0 FROM ( (SELECT "TEST1"."ID"
    "ID","TEST1"."DATE1" "DATE1" FROM "TEST1" "TEST1" WHERE
    "TEST1"."DATE1"=:B1 AND "TEST1"."ID"=:B2)MINUS (SELECT "TEST2"."ID"
    "ID","TEST2"."DATE1" "DATE1" FROM "TEST2" "TEST2" WHERE
    "TEST2"."DATE1"=:B3 AND "TEST2"."ID"=:B4)) "I"))
    7 - filter("TEST1"."DATE1"=:B1 AND "TEST1"."ID"=:B2)
    9 - filter("TEST2"."DATE1"=:B1 AND "TEST2"."ID"=:B2)
    Note: rule based optimization
    28 rows selected.
    ORA92080>
    ORA92080>BEGIN
    2 DBMS_STATS.GATHER_TABLE_STATS
    3      ( ownname     => USER,
    4      tabname     => 'TEST2',
    5      estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
    6      cascade     => TRUE
    7      );
    8 END;
    9 /
    PL/SQL procedure successfully completed.
    ORA92080>
    ORA92080>/*
    DOC>| This is the identical query as above. With statistics gathered, the
    DOC>| cost-based optimizer is used. An incorrect count of 1 is returned.
    DOC>*/
    ORA92080>SELECT COUNT(*) FROM test1 t
    2 WHERE EXISTS
    3      ( SELECT 'X'
    4      FROM ( SELECT id, date1
    5                FROM test1
    6           MINUS
    7           SELECT id, date1
    8                FROM test2
    9           ) i
    10      WHERE i.id = t.id
    11           AND i.date1 = t.date1
    12      );
    COUNT(*)
    1
    1 row selected.
    ORA92080>
    ORA92080>/* Using rule-based optimizer, the result is correct. */
    ORA92080>SELECT /*+ RULE */ COUNT(*) FROM test1 t
    2 WHERE EXISTS
    3      ( SELECT 'X'
    4      FROM ( SELECT id, date1
    5                FROM test1
    6           MINUS
    7           SELECT id, date1
    8                FROM test2
    9           ) i
    10      WHERE i.id = t.id
    11           AND i.date1 = t.date1
    12      );
    COUNT(*)
    2
    1 row selected.
    ORA92080>
    ORA92080>EXPLAIN PLAN FOR
    2 SELECT COUNT(*) FROM test1 t
    3 WHERE EXISTS
    4      ( SELECT 'X'
    5      FROM ( SELECT id, date1
    6                FROM test1
    7           MINUS
    8           SELECT id, date1
    9                FROM test2
    10           ) i
    11      WHERE i.id = t.id
    12           AND i.date1 = t.date1
    13      );
    Explained.
    ORA92080>
    ORA92080>SET ECHO OFF
    Wrote file reset.sql
    Session altered.
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 1 | 44 | 11 |
    | 1 | SORT AGGREGATE | | 1 | 44 | |
    |* 2 | HASH JOIN SEMI | | 1 | 44 | 11 |
    | 3 | TABLE ACCESS FULL | TEST1 | 82 | 1804 | 2 |
    | 4 | VIEW | | 1 | 22 | 8 |
    | 5 | MINUS | | | | |
    | 6 | SORT UNIQUE | | 1 | 31 | |
    |* 7 | TABLE ACCESS FULL| TEST1 | 1 | 31 | 2 |
    | 8 | SORT UNIQUE | | 1 | 22 | |
    |* 9 | TABLE ACCESS FULL| TEST2 | 1 | 22 | 2 |
    Predicate Information (identified by operation id):
    2 - access("I"."ID"="T"."ID" AND "I"."DATE1"="T"."DATE1")
    7 - filter("TEST1"."DATE1">TO_DATE(' 1960-01-01 00:00:00',
    'syyyy-mm-dd hh24:mi:ss') AND "TEST1"."DATE2">TO_DATE(' 1960-01-01
    00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
    9 - filter("TEST2"."DATE1">TO_DATE(' 1960-01-01 00:00:00',
    'syyyy-mm-dd hh24:mi:ss'))
    Note: cpu costing is off
    27 rows selected.
    ORA92080>/*
    DOC>| Workaround: change the check constraint on the test1 table that is causing the problem.
    DOC>*/
    ORA92080>ALTER TABLE test1
    2 DROP CONSTRAINT test1_chk_date2;
    Table altered.
    ORA92080>
    ORA92080>ALTER TABLE test1
    2 ADD ( CONSTRAINT test1_chk_date2
    3      CHECK ( date2 >= date1 OR date2 IS NULL )
    4      EXCEPTIONS INTO exceptions
    5      );
    Table altered.
    ORA92080>
    ORA92080>SELECT COUNT(*) FROM test1 t
    2 WHERE EXISTS
    3      ( SELECT 'X'
    4      FROM ( SELECT id, date1
    5                FROM test1
    6           MINUS
    7           SELECT id, date1
    8                FROM test2
    9           ) i
    10      WHERE i.id = t.id
    11           AND i.date1 = t.date1
    12      );
    COUNT(*)
    2
    1 row selected.
    ORA92080>
    ORA92080>EXPLAIN PLAN FOR
    2 SELECT COUNT(*) FROM test1 t
    3 WHERE EXISTS
    4      ( SELECT 'X'
    5      FROM ( SELECT id, date1
    6                FROM test1
    7           MINUS
    8           SELECT id, date1
    9                FROM test2
    10           ) i
    11      WHERE i.id = t.id
    12           AND i.date1 = t.date1
    13      );
    Explained.
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 1 | 44 | 11 |
    | 1 | SORT AGGREGATE | | 1 | 44 | |
    |* 2 | HASH JOIN SEMI | | 1 | 44 | 11 |
    | 3 | TABLE ACCESS FULL | TEST1 | 409 | 8998 | 2 |
    | 4 | VIEW | | 20 | 440 | 8 |
    | 5 | MINUS | | | | |
    | 6 | SORT UNIQUE | | 20 | 440 | |
    |* 7 | TABLE ACCESS FULL| TEST1 | 20 | 440 | 2 |
    | 8 | SORT UNIQUE | | 1 | 22 | |
    |* 9 | TABLE ACCESS FULL| TEST2 | 1 | 22 | 2 |
    Predicate Information (identified by operation id):
    2 - access("I"."ID"="T"."ID" AND "I"."DATE1"="T"."DATE1")
    7 - filter("TEST1"."DATE1">TO_DATE(' 1960-01-01 00:00:00',
    'syyyy-mm-dd hh24:mi:ss'))
    9 - filter("TEST2"."DATE1">TO_DATE(' 1960-01-01 00:00:00',
    'syyyy-mm-dd hh24:mi:ss'))
    Note: cpu costing is off
    26 rows selected.
    ORA92080>

    Justin,
    Thanks for the reply. I have sent this test case to my DBA who may submit it to Metalink.
    Since I have found and implemented a workaround, I can wait for the next service release. I just thought that this might be of interest to other Oracle users.
    My work-around (buried near the end of my original post) was to modify all check constraints that fit the pattern:
    ( not_nullable_column condition IS TRUE )
    AND ( nullable_column condition IS TRUE )
    To:
    ( not_null_column condition IS TRUE )
    AND ( nullable_column condition IS TRUE OR nullable_column IS NULL )
    Redefining a check constraint in this way prevents it from being used in the optimizer's predicate.
    If someone at Oracle Support wanted to submit code that identifies such potential problem constraints in the data dictionary, that would be great too.
    - Doug

  • Oracle Optimizer bug

    I ran a query in Oracle SQL Developer reading exadata database.
    I am running a query which is taking 2 hours to run.
    The query is as follows:
    The plan for the query and the predicate information are also attached.
    The problem: optimizer is identifying a join to be merge join cartesian. (operation 12)
    But if we remove the filter conditions (mark lewis and account filter from the where clause), the query completes in 2 mins (and with cartesian join).
    If i use inline query it does not throw any issues and runs swiftly.
    Any ideas on why this is happening will be appreciated.

    two things:
    wrong forum, try the SQL and PL/SQL community
    the OTN Community is not for bugs, please open a Service Request with My Oracle Support

  • Azure SQL Data Sync, LINQ optimization bug

    How can I report the following Bug ?
    var empty = new Set<int>();
    var query = storage.table.Where(item => empty.Contains(item.id));
    // Entity Framework Extended
    query.DeleteAsync()
    The query is optimized to something like this, because the set is empty, and therefore the result set is always empty:
    SELECT
    CAST(NULL AS uniqueidentifier) AS [C1],
    CAST(NULL AS uniqueidentifier) AS [C2],
    CAST(NULL AS int) AS [C3],
    CAST(NULL AS int) AS [C4],
    CAST(NULL AS datetime2) AS [C5],
    CAST(NULL AS varchar(1)) AS [C6],
    CAST(NULL AS int) AS [C7]
    FROM ( SELECT 1 AS X ) AS [SingleRowTable1]
    WHERE 1 = 0
    Now the problem is that update and delete trigger, introduced by Azure SQL Data Sync, will fail because they require the primary key, which is not part of the optimized query. Meaning that when the set is empty the triggers will fail, but if the set contains
    an id, the query is not optimized and therefore will succeed.
    (SELECT [i].[PrimaryKeyId] FROM DELETED AS [i])
    Notice, the problem here is not Entity Framework Extended from my perspective, but the Azure SQL Data Sync Triggers! 

    not sure if i understood your post correctly, but the columns available in the logical inserted and deleted tables available in the trigger are the actual columns of the table itself, not the columns in the query that caused the trigger to fire.

  • Optimizer bug in C compiler for Linux

    Save the following as bug.c:
    Bug report against Sun C for Linux:
    $ suncc -V
    cc: Sun C 5.9 Linux_i386 Build27_2 2006/08/02
    usage: cc [ options] files.  Use 'cc -flags' for details
    $ cat /etc/SuSE-release
    SuSE Linux 9.3 (x86-64)
    VERSION = 9.3
    $ uname -r
    2.6.11.4-21.8-smp
    Compiled w/ -xO2 or lower, this program runs to completion:
    $ suncc -xO2 bug.c -o bug -lpthread && ./bug
    Hello from thread 0
    Hello from thread 1
    Hello from thread 2
    Hello from thread 3
    DONE.
    However, when compiled w/ -xO3 (or higher) this program hangs:
    $ suncc -xO3 bug.c -o bug -lpthread && ./bug
    Hello from thread 0
    Hello from thread 1
    Hello from thread 2
    Hello from thread 3
    ...hung here...
    ^C
    Changing "#if 0" to "#if 1" changes a "while (cond) {body;}" to a
    "do {body;} while(cond)", and is sufficient to work around the
    problem in this case.
    #include <stdio.h>
    #include <stdlib.h>
    #include <inttypes.h>
    #include <pthread.h>
    static unsigned int numthreads = 4;
        static void test_pthread_barrier(void) {
          static pthread_cond_t barrier_cond[2] =
            { PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER };
          static pthread_mutex_t barrier_mutex[2] =
            { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER };
          static volatile unsigned int barrier_count = 0;
          static volatile int phase = 0;
          const int myphase = phase;
          pthread_mutex_lock(&barrier_mutex[phase]);
          barrier_count++;
          if (barrier_count < numthreads) {
    #if 0
            do {
              pthread_cond_wait(&barrier_cond[myphase], &barrier_mutex[myphase]);
            } while (myphase == phase);
    #else
            while (myphase == phase) {
              pthread_cond_wait(&barrier_cond[myphase], &barrier_mutex[myphase]);
    #endif
          } else {
            barrier_count = 0;
            phase = !phase;
            pthread_cond_broadcast(&barrier_cond[!phase]);
          pthread_mutex_unlock(&barrier_mutex[!phase]);
    static void * thread_main(void * arg) {
      printf("Hello from thread %d\n", (int)(uintptr_t)arg);
      test_pthread_barrier();
      return NULL;
    int main(void) {
        int i;
        pthread_t *threadid = (pthread_t *)malloc(sizeof(pthread_t)*numthreads);
        for(i=0;i<numthreads;i++) {
          void *threadarg;
          pthread_attr_t attr;
          pthread_attr_init(&attr);
          pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); /* ignore failures */
          pthread_create(&threadid, &attr, &thread_main, (void *)(uintptr_t)i);
    pthread_attr_destroy(&attr);
    for(i=0;i<numthreads;i++) {
    void *retval = NULL;
    pthread_join(threadid[i], &retval);
    free(threadid);
    printf("DONE.\n");
    return 0;

    You can refer to this bug as 6499729.
    The bug status will soon be visible on bugs.sun.com

  • Optimizer regression in 9.2

    Hi, we have serious performance degradation problems after migration from 8.0.6 to 9.2.0.4.0
    The greatest problem is caused by the difference in the access plans
    generated by the optimizer. Having the simple test table with 2 indexes:
    CREATE TABLE PRUEBA
    CAMPO1 VARCHAR2(10) NOT NULL,
    CAMPO2 VARCHAR2(10) NOT NULL,
    CAMPO3 VARCHAR2(10) NOT NULL,
    CAMPO4 VARCHAR2(10) NOT NULL
    NOPARALLEL;
    CREATE UNIQUE INDEX I_2_3_4 ON PRUEBA
    (CAMPO2, CAMPO3, CAMPO4)
    ALTER TABLE PRUEBA ADD (
    CONSTRAINT PK PRIMARY KEY (CAMPO1)
    USING INDEX
    After that insert 100000 rows, and issue the following query and have different execution plans in 8.x and 9.2:
    select campo1,campo2
    from prueba
    where (campo1= :valor1 Or campo2= :valor2) and rownum <=2
    Execution plan in 8.0.6:
    SELECT STATEMENT Optimizer Mode=CHOOSE                                        
    COUNT STOPKEY                                        
    CONCATENATION                                        
    FILTER                                        
    TABLE ACCESS BY INDEX ROWID     PRUEBA                                   
    INDEX RANGE SCAN     I_2_3_4                                   
    FILTER                                        
    TABLE ACCESS BY INDEX ROWID     PRUEBA                                   
    INDEX UNIQUE SCAN     PK                              
    Execution plan in 9.2.0.4.0:
    SELECT STATEMENT Optimizer Mode=CHOOSE                                        
    COUNT STOPKEY                                        
    TABLE ACCESS FULL     PRUEBA          
    WHY ??????? It has serious performance implicattions in our application when table prueba has 50 million rows!!!
    Optimizer mode is choose, and tables are not analyzed because of man power implications in such change.

    Some mor info:
    Hi,
    the parameter optimizer_mode is set to CHOOSE because our tables are not analyzed. The only tables analyzed are partitioned tables, and where the joins involving partitioned tables + not partitioned tables have the hints needed, but joins involving only NOT Patitioned tables, thus NOT analyzed tables, are using RBO.
    I have tried the example query in the folowing scenarios/parameters:
    1) 9.2.0.4.0 database server ->
    SELECT STATEMENT Optimizer Mode=CHOOSE
    COUNT STOPKEY
    TABLE ACCESS FULL PRUEBA
    2) 9.0.1.3.1 database server ->
    SELECT STATEMENT Optimizer Mode=CHOOSE
    COUNT STOPKEY
    CONCATENATION
    FILTER
    TABLE ACCESS BY INDEX ROWID PRUEBA
    INDEX RANGE SCAN I_2_3_4
    FILTER
    TABLE ACCESS BY INDEX ROWID PRUEBA
    INDEX UNIQUE SCAN PK
    3) Finally tried 9.2.0.4.0 database server setting parameter optimizer_features_enable=9.0.1 ->
    SELECT STATEMENT Optimizer Mode=CHOOSE
    COUNT STOPKEY
    TABLE ACCESS FULL PRUEBA
    WHY???? The execution plan shuold be the same as in 9.0.1 database version or not ?????
    Table and indexes are not analyzed, thus the optimizer must be using RULE, but where is the difference???? It look like optimizer bug, not???

  • Studio 11: bug in -O2 mode (64-bit) causes 'ube' error in Qt-4.1.0

    I think I have found a 64-bit optimizer bug in latest Studio 11
    C++ compiler (CC -V: CC: Sun C++ 5.8 2005/10/13) when compiling
    Qt-4.1.0/X11 with -O2 and with -xarch=generic64 on
    Solaris 10/x86 (Opteron [Sun Fire V20z]).
    To reproduce the problem, get latest Qt-4.1.0/X11 source code
    (will probably be available to the public in a few days).
    Unpack, then configure & build with:
    # ./configure -release -platform solaris-cc-64
    # make
    CC -c -xarch=generic64 -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ -O2 -DQT_EDITION=QT_EDITION_DESKTOP -DQT_BOOTSTRAPPED -DQT_RCC -DQT_LITE_UNICODE -DQT_NO_DATASTREAM -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_UNICODETABLES -DQT_NO_LIBRARY -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../../mkspecs/solaris-cc-64 -I. -I../../corelib/arch/generic -I../../../include -I. -I../../../include/QtCore -I../../../include/QtXml -I. -I/usr/sfw/include -o .obj/release-shared/qxml.o ../../xml/qxml.cpp
    "../../xml/qdom.cpp", line 2074: Warning: lineNumber hides QDomNodePrivate::lineNumber.
    "../../xml/qdom.cpp", line 2074: Warning: columnNumber hides QDomNodePrivate::columnNumber.
    "../../xml/qdom.cpp", line 4532: Warning: prefix hides QDomNodePrivate::prefix.
    "../../xml/qdom.cpp", line 7477: Warning: locator hides QDomHandler::locator.
    4 Warning(s) detected.
    "../../xml/qxml.cpp", line 3385: Warning: Done hides QXmlSimpleReaderPrivate::Done.
    [...repeats 18x...]
    "../../xml/qxml.cpp", line 7757: Warning: error hides QXmlSimpleReaderPrivate::error.
    20 Warning(s) detected.
    "../../xml/qxml.cpp", line 4522: [__1cXQdDXmlSimpleReaderPrivateHparsePI6M_b_]:ube: error: Bad template number found in tmpl_emit
    gmake[2]: *** [.obj/release-shared/qxml.o] Error 154
    gmake[2]: *** Waiting for unfinished jobs....
    gmake[2]: Leaving directory `/usr/local/qt-x11-commercial-src-4.1.0/src/tools/rcc'
    gmake[1]: *** [sub-tools-rcc-make_default-ordered] Error 2
    gmake[1]: Leaving directory `/usr/local/qt-x11-commercial-src-4.1.0/src'
    gmake: *** [sub-src-make_default-ordered] Error 2
    #The same file compiles fine if you just change -O2 into -O1 or
    -O3 (or -O) or if you omit -xarch=generic64 (i.e. compile for 32 bits architecture).
    Can anybody confirm this?
    Thanks,
    Jochen
    PS: For the records: to get Qt-4.1.0 compiled anyway, simply change -O2 into -O in
    file $QTDIR/mkspecs/solaris-cc-64/qmake.confbefore running configure

    Jochen,
    this is indeed a x86 optimizer bug. Thank you for reporting it. Indeed, -xO2 is the only optimization level which triggers the error for the file qxml.cpp, so if you can use -xO3 (or, the same, -O), the compiler will most likely produce more optimized binary.
    Thanks,
    Boris

  • OJVM bug ??

    Hi,
    I found some discrepency on the results shown by memory profiler of JDEV (9.0.2) and that of NetBeans (IDE 4.0). Also, results of JDEV profiler is in contradiction to what Sun Java says (as per my own interpretation!). Here is what I am trying to do -
    1. Loading classes dynamically using a custom classloader.
    2. Once usage of the dynamically loaded class is finished, I am setting the classloader reference to null, so that next time the classloader loads the class afresh.
    The code is working fine as per as loading the classes dynamically is concerned. However, while debugging in jdev, I monitored the classes being loaded and the heap size. This showed that the classloader is not being unloaded from memory and the count and size are increasing. The reference path of each of the classloader shows that the reference is being held by the class loaded by the classloader. This goes into a loop as Sun java says that to unload a class from memory, the classloader needs to be unloaded. I was using OJVM with java version - 1.3.1_02
    When I tested the same code with NetBeans memory profiler it showed that the count of classloader objects increasing with every instantiation, but the number of live objects in memory is zero. The NetBean IDE was using Java 1.4.2_07.
    Could this be a problem of -
    1. My interpretation.
    2. Java version (1.3.1_02) of OJVM that I am using.
    3. Jdeveloper.
    Would appreciate any help in this regard.
    Thanks in advance
    Indranil

    Yes, this is an JVM optimizer bug. Thanks for reporting it, we didn't know about it. We will fix it for 9.0.4 and subsequent releases. In the mean time, you have two options:
    1 - Run your application with the following addtional
    JVM option -XOd
    2 - Run your application with -client jvm
    Michel

  • How to fetch data only from index

    Hi,
    I'm using below query which fetches arount 1,00,000 records & then perform group operations on them.
    <pre>
    SELECT Record_Type,Country_Product_Id,Channel_Id,SUM(Items)
    FROM t_Utr
    WHERE Four_Eyes_Status='A'
    AND(
    Booking_Date >= To_Date(v_Period_Start_Date, 'DD/MM/YYYY')
    AND Booking_Date <= To_Date(v_Period_End_Date , 'DD/MM/YYYY')
    AND Invoice_Id IS NULL
    AND Link_Id=p_Link_Id
    AND Billing_Indicator = 'L'
    GROUP BY Record_Type, Country_Product_Id, Channel_Id
    </pre>
    I'm having an index on all the columns being searched and all the values being fetched.
    Here I want to know if there is some procedure where we can fetch all the data from index itself, & we need not to switch again & again between table & index data.
    Thanks
    Deepak

    That's the kind of thing you want to leave to the optimizer.
    Provided you supply it with the information needed, most of the time it will make a better decision than you will on speculation.
    You want to avoid "hard coding" execution plans since this is contrary to the principles of the CBO and the "what" vs "where" philosophy underlying declarative programming.
    A few thoughts:
    1) Possibly the "AND Invoice_Id IS NULL" gets in the way of that of index only lookup
    2) To raise an optimizer bug/change request you will need to prove that your suggested plan is (a) possible (b) superior to the optimizer's choice (c) the optimizer choice is based on erroneous logic (possibly via 10053 trace)

  • Performance issue with MSEG table

    Hi all,
    I need to fetch materials(MATNR) based on the service order number (AUFNR) in the selection screen,but there is performance isssue with this , how to over come this issue .
    Regards ,
    Amit

    Hi,
    There could be various reasons for performance issue with MSEG.
    1) database statistics of tables and indexes are not upto date.
    because of this wrong index is choosen during the execution.
    2) Improper indexes, because there is no indexes with the fields mentioned in the WHERE clause of the statement. Because of this reason, CBO would have choosen wrong index and did a range scan.
    3) Optimizer bug in oracle.
    4) Size of table is very huge, archive.
    Better switch on ST05 trace before you run this statements, so it will give more detailed information, where exactly time being spent during the execution.
    Hope this helps
    dileep

  • How to write a 2-D Array of Doubles to a binary file in LabView 8.5?

    Okay, this is driving me nuts. I got a program that worked fine in LabView 8.0 but refused to write any data after my institute upgraded to LabView 8.5. The data is stored in a 2-D array of doubles and is supposed to be written to a binary file, that has been correctly opened and got a header written to it containing some meta-data of the measurement. But when the doubles from the array should be written to the file, nothing happens. All I get is an (except for the header) empty file of 786 kB. I found out that writing works if I convert the data from the array to singles right before wiring them to the "write to binary file" VI, but for several reasons I need the data as doubles. Can anyone help me? I've tried everything anyone has written here about writing to binary files and more.
    Remember, it worked perfectly fine with an older version of LabView. Any ideas?

    It is possible that you run into a known memory optimization bug.
    Try to place an "always copy" primitive as discussed here.
    Message Edited by altenbach on 11-18-2008 09:11 AM
    LabVIEW Champion . Do more with less code and in less time .

  • Exception (or crash) when executing an XmlModify with multiple remove exprs

    Hi all,
    The following code snippet resembles my execution path for updating some nodes in a document.
        XmlManager manager = DbController::getInstance()->getManager();
        XmlContainer container = DbController::getInstance()->getContainer();
        XmlTransaction mainTransaction = manager.createTransaction(DB_TXN_NOWAIT);
        XmlQueryContext queryContext = manager.createQueryContext();
        XmlTransaction childTransaction = mainTrContext->getXmlTransaction().createChild();
        XmlDocument document = container.getDocument(childTransaction, "mydocdir/docname", 0);
        childTransaction.commit();
        XmlValue nodeXmlValue;
        XmlQueryExpression docNodeExpression = manager.prepare(mainTransaction, "/acquisitionProtocol", queryContext
        XmlResults resultList = docNodeExpression.execute(mainTransaction, mainTrContext->getDocument()->getXmlValue(), queryContext
        if (resultList.size() > 0)
            resultList.next(nodeXmlValue);   
    //                        XmlValue nodeXmlValue(mainTrContext->getDocument()->getXmlDocument());
        XmlUpdateContext updateContext = manager.createUpdateContext();
        XmlModify modifier = manager.createModify();
        XmlQueryExpression nodeQueryExpression = manager.prepare(mainTransaction, "./location", queryContext);
        modifier.addRemoveStep(nodeQueryExpression);
        XmlQueryExpression nodeQueryExpression = manager.prepare(mainTransaction, "./id", queryContext);
        modifier.addRemoveStep(nodeQueryExpression);
        nodeQueryExpression = manager.prepare(mainTransaction, ".", queryContext);
        modifier.addAppendStep(nodeQueryExpression, XmlModify::Element, "location", "yves/test", 0);
        modifier.execute(mainTransaction, nodeXmlValue, queryContext, updateContext);
        mainTransaction.commit();When I execute the modifier (2de last line) it throws the following exception or crashes:
    DBcursor->get: DB_READ_COMMITTED, DB_READ_UNCOMMITTED and DB_RMW require locking
    Exception code: 5
    Error text:Error: Invalid argument File: NsEventReader.cpp Line: 828
    DbErrno: 22The problem occurs when adding more than one remove expression to the modify object. If I use only one remove expression, the code works fine.
    However, I can add multiple append expression without problems.
    What am I doing wrong here???
    Thanks in advance
    Yves
    Edited by: ywillems on Dec 10, 2008 7:55 AM
    Edited by: ywillems on Dec 11, 2008 5:37 AM
    Edited by: ywillems on Dec 11, 2008 7:05 AM

    Yves,
    Oddly enough I believe this is an optimizer bug that we've found and patched (but not yet officially released the patch). Try applying this patch to 2.4.16:
    diff -ru dbxml-2.4.16-original/dbxml/src/dbxml/query/DecisionPointQP.cpp dbxml-2.4.16/dbxml/src/dbxml/query/DecisionPointQP.cpp
    --- dbxml-2.4.16-original/dbxml/src/dbxml/query/DecisionPointQP.cpp
    +++ dbxml-2.4.16/dbxml/src/dbxml/query/DecisionPointQP.cpp
    @@ -1,14 +1,13 @@
    // See the file LICENSE for redistribution information.
    // Copyright (c) 2002,2008 Oracle.  All rights reserved.
    -// $Id$
    #include "../DbXmlInternal.hpp"
    #include "DecisionPointQP.hpp"
    #include "QueryPlanHolder.hpp"
    #include "../QueryContext.hpp"
    #include "../Manager.hpp"
    #include "../Container.hpp"
    @@ -269,17 +268,17 @@ protected:
       XPath2MemoryManager *mm_;
    DecisionPointQP::ListItem *DecisionPointQP::justInTimeOptimize(int contID, DynamicContext *context)
         // **** IMPORTANT - This algorithm is very carefully arranged to avoid
         // **** deadlocks and race-conditions. Don't rearrange things unless you
         // **** know what you are doing!
    +     
         // Get the runtime configuration
         DbXmlConfiguration *conf = GET_CONFIGURATION(context);
         // Lookup the container
         ScopedContainer scont((Manager&)conf->getManager(), contID, /*mustExist*/true);
         // Just-in-time optimise the QueryPlan, using a temporary memory manager for thread safety
         XPath2MemoryManagerImpl tmpMM;
    @@ -349,17 +348,18 @@ void DecisionPointQP::justInTimeOptimize
         qp->staticTypingLite(context);
              OptimizationContext opt(OptimizationContext::REARRANGE, context, 0, container);
              qp = qp->optimize(opt);
              qp->logQP(opt.getLog(), "OQP", qp, opt.getPhase());
              OptimizationContext opt(OptimizationContext::ALTERNATIVES, context, 0, container);
    -          qp = qp->chooseAlternative(opt, "decision point", container->getContainerID() == 0);
    +          opt.setCheckForSS(container->getContainerID() == 0);
    +          qp = qp->chooseAlternative(opt, "decision point");
              qp->logQP(opt.getLog(), "OQP", qp, opt.getPhase());
              OptimizationContext opt(OptimizationContext::ADD_STEPS, context, 0, container);
              qp = qp->optimize(opt);
              qp->logQP(opt.getLog(), "OQP", qp, opt.getPhase());
    @@ -390,26 +390,37 @@ DecisionPointQP::DecisionPointQP(const D
           removed_(false),
           qpList_(0),
           qpListDone_(o->qpListDone_),
           compileTimeMinder_(o->compileTimeMinder_),
           compileTimeContext_(o->compileTimeContext_)
         if(arg_ != 0)
              _src.add(arg_->getStaticAnalysis());
    +     
    +     bool checkForSS = opt.checkForSS();
    +     
    +     try {
    +          ListItem **li = &qpList_;
    +          for(ListItem *oli = o->qpList_; oli != 0; oli = oli->next) {
    +               opt.setCheckForSS(oli->container->getContainerID() == 0);
    +          
    +               *li = new (mm) ListItem(oli->container, 0);
    +               (*li)->qp = oli->qp->chooseAlternative(opt, "decision point");
    -     ListItem **li = &qpList_;
    -     for(ListItem *oli = o->qpList_; oli != 0; oli = oli->next) {
    -          *li = new (mm) ListItem(oli->container, 0);
    -          (*li)->qp = oli->qp->chooseAlternative(opt, "decision point", oli->container->getContainerID() == 0);
    +               _src.add((*li)->qp->getStaticAnalysis());
    -          _src.add((*li)->qp->getStaticAnalysis());
    -          li = &(*li)->next;
    +               li = &(*li)->next;
    +          }
    +     catch(...) {
    +          opt.setCheckForSS(checkForSS);
    +          throw;
    +     }
    +     opt.setCheckForSS(checkForSS);
    DecisionPointQP::DecisionPointQP(const DecisionPointQP *o, XPath2MemoryManager *mm)
         : QueryPlan(DECISION_POINT, o->getFlags(), mm),
           dps_(o->dps_ ? o->dps_->copy(mm) : 0),
           arg_(o->arg_ ? o->arg_->copy(mm) : 0),
           removed_(false),
           qpList_(0),
    diff -ru dbxml-2.4.16-original/dbxml/src/dbxml/query/QueryPlan.cpp dbxml-2.4.16/dbxml/src/dbxml/query/QueryPlan.cpp
    --- dbxml-2.4.16-original/dbxml/src/dbxml/query/QueryPlan.cpp
    +++ dbxml-2.4.16/dbxml/src/dbxml/query/QueryPlan.cpp
    @@ -1,14 +1,13 @@
    // See the file LICENSE for redistribution information.
    // Copyright (c) 2002,2008 Oracle.  All rights reserved.
    -// $Id$
    #include "../DbXmlInternal.hpp"
    #include <assert.h>
    #include <string.h>
    #include <sstream>
    #include <set>
    #include <algorithm>
    @@ -128,23 +127,54 @@ void QueryPlan::createAlternatives(unsig
         createCombinations(maxAlternatives, opt, combinations);
         // Generate the alternatives by applying conversion rules to the combinations
         for(QueryPlans::iterator it = combinations.begin(); it != combinations.end(); ++it) {
              (*it)->applyConversionRules(maxAlternatives, opt, alternatives);
    -CostSortItem::CostSortItem(QueryPlan *qp, OperationContext &oc, QueryExecutionContext &qec)
    -     : qp_(qp), cost_(qp->cost(oc, qec))
    +class ContainsSequentialScan : public NodeVisitingOptimizer
    +public:
    +     bool run(QueryPlan *qp)
    +     {
    +          found = false;
    +          optimizeQP(qp);
    +          return found;
    +     }
    +
    +private:
    +     virtual void resetInternal() {}
    +
    +     virtual ASTNode *optimize(ASTNode *item)
    +     {
    +          // Don't look inside ASTNode objects
    +          return item;
    +     }
    +     virtual QueryPlan *optimizeSequentialScan(SequentialScanQP *item)
    +     {
    +          found = true;
    +          return item;
    +     }
    +
    +     bool found;
    +};
    +
    +CostSortItem::CostSortItem(QueryPlan *qp, OperationContext &oc, QueryExecutionContext &qec, bool checkForSS)
    +     : qp_(qp), cost_(qp->cost(oc, qec)),
    +       hasSS_(false)
    +{
    +     if(checkForSS) hasSS_ = ContainsSequentialScan().run(qp);
    bool CostSortItem::operator<(const CostSortItem &o) const
    +        if(hasSS_ != o.hasSS_) return !hasSS_;
    +     
         if(cost_.totalPages() < o.cost_.totalPages()) return true;
         if(cost_.totalPages() > o.cost_.totalPages()) return false;
         if(cost_.pagesOverhead < o.cost_.pagesOverhead) return true;
         if(cost_.pagesOverhead > o.cost_.pagesOverhead) return false;
         return qp_ < o.qp_;
    @@ -189,22 +219,22 @@ void QueryPlan::createReducedAlternative
                   if(i != costSortSet.end()) {
                        (*it)->release();
                        continue;
                   ++alternativesCount;
    -               costSortSet.insert(CostSortItem(*it, oc, qec));
    +               costSortSet.insert(CostSortItem(*it, oc, qec, opt.checkForSS()));
                   if(costSortSet.size() > ALTERNATIVES_THRESHOLD) {
                        // Trim all QueryPlans outside of a factor of the cost of the lowest cost QueryPlan
                        // TBD Make the specific factor configurable - jpcs
    -                    set<CostSortItem>::iterator cutPoint = costSortSet.lower_bound(costSortSet.begin()->cost_.totalPages() * cutOffFactor);
    +                    set<CostSortItem>::iterator cutPoint = costSortSet.lower_bound(CostSortItem(costSortSet.begin()->cost_.totalPages() * cutOffFactor, false));
                        if(cutPoint != costSortSet.begin() && cutPoint != costSortSet.end()) {
                             for(i = cutPoint; i != costSortSet.end(); ++i) {
                                  if(Log::isLogEnabled(Log::C_OPTIMIZER, Log::L_DEBUG)) {
                                       ostringstream oss;
                                       oss << "Rejected Alternative (outside cut off factor: ";
                                       oss << (costSortSet.begin()->cost_.totalPages() * cutOffFactor);
                                       oss << ")";
                                       log(qec, oss.str());
    @@ -247,54 +277,27 @@ void QueryPlan::createReducedAlternative
         } else {
              for(set<CostSortItem>::iterator i = costSortSet.begin(); i != costSortSet.end(); ++i) {
                   alternatives.push_back(i->qp_);
    -class ContainsSequentialScan : public NodeVisitingOptimizer
    +static bool betterAlternativeCost(const Cost &costA, bool ssA, const Cost &costB, bool ssB, bool checkForSS)
    -public:
    -     bool run(QueryPlan *qp)
    -          found = false;
    -          optimizeQP(qp);
    -          return found;
    -private:
    -     virtual void resetInternal() {}
    -     virtual ASTNode *optimize(ASTNode *item)
    -          // Don't look inside ASTNode objects
    -          return item;
    -     virtual QueryPlan *optimizeSequentialScan(SequentialScanQP *item)
    -          found = true;
    -          return item;
    -     bool found;
    -static bool betterAlternativeCost(const Cost &costA, bool ssA, const Cost &costB, bool ssB, bool noSequentialScan)
    -     if(ssA != ssB && noSequentialScan) return ssB;
    +     if(ssA != ssB && checkForSS) return ssB;
         if(costA.totalPages() < costB.totalPages()) return true;
         if(costA.totalPages() > costB.totalPages()) return false;
         return costA.pagesOverhead < costB.pagesOverhead;
    -QueryPlan *QueryPlan::chooseAlternative(OptimizationContext &opt, const char *name, bool noSequentialScan) const
    +QueryPlan *QueryPlan::chooseAlternative(OptimizationContext &opt, const char *name) const
         QueryPlans combinations;
         createCombinations(MAX_ALTERNATIVES, opt, combinations);
         // TBD remove the need for QueryExecutionContext here - jpcs
         QueryExecutionContext qec(GET_CONFIGURATION(opt.getContext())->getQueryContext(),
              /*debugging*/false);
         qec.setContainerBase(opt.getContainerBase());
    @@ -313,17 +316,17 @@ QueryPlan *QueryPlan::chooseAlternative(
              for(QueryPlans::iterator it = myAlts.begin(); it != myAlts.end(); ++it) {
                   ++alternativesCount;
                   QueryPlan *qp = (*it);
                   Cost itCost = qp->cost(opt.getOperationContext(), qec);
                   bool itSS = ContainsSequentialScan().run(qp);
    -               if(bestQP == 0 || betterAlternativeCost(itCost, itSS, bestCost, bestSS, noSequentialScan)) {
    +               if(bestQP == 0 || betterAlternativeCost(itCost, itSS, bestCost, bestSS, opt.checkForSS())) {
                        if(bestQP != 0) {
                             log(qec, "Rejected Alternative (not best)");
                             bestQP->logCost(qec, bestCost, 0);
                             bestQP->release();
                        bestQP = qp;
                        bestCost = itCost;
                        bestSS = itSS;
    diff -ru dbxml-2.4.16-original/dbxml/src/dbxml/query/QueryPlan.hpp dbxml-2.4.16/dbxml/src/dbxml/query/QueryPlan.hpp
    --- dbxml-2.4.16-original/dbxml/src/dbxml/query/QueryPlan.hpp
    +++ dbxml-2.4.16/dbxml/src/dbxml/query/QueryPlan.hpp
    @@ -1,14 +1,13 @@
    // See the file LICENSE for redistribution information.
    // Copyright (c) 2002,2008 Oracle.  All rights reserved.
    -// $Id$
    #ifndef __QUERYPLAN_HPP
    #define     __QUERYPLAN_HPP
    #include <vector>
    #include <set>
    #include <string>
    @@ -60,40 +59,44 @@ public:
              REARRANGE = 2,
              ALTERNATIVES = 3,
              ADD_STEPS = 4,
              MAKE_PREDICATES = 5,
              REMOVE_REDUNDENTS = 6
         OptimizationContext(Phase ph, DynamicContext *cn, QueryPlanOptimizer *qpo, ContainerBase *c = 0)
    -          : phase_(ph), context_(cn), qpo_(qpo), container_(c), isFetched_(false) {}
    +          : phase_(ph), context_(cn), qpo_(qpo), container_(c), isFetched_(false), checkForSS_(false) {}
         Phase getPhase() const { return phase_; }
         DynamicContext *getContext() const { return context_; }
         XPath2MemoryManager *getMemoryManager() const;
         QueryPlanOptimizer *getQueryPlanOptimizer() const { return qpo_; }
         void setQueryPlanOptimizer(QueryPlanOptimizer *qpo) { qpo_ = qpo; }
         ContainerBase *getContainerBase() const { return container_; }
         Transaction *getTransaction() const;
         OperationContext &getOperationContext() const;
         const IndexSpecification &getIndexSpecification() const;
         const Log &getLog() const;
    +     bool checkForSS() const { return checkForSS_; }
    +     void setCheckForSS(bool val) { checkForSS_ = val; }
    +
    private:
         Phase phase_;
         DynamicContext *context_;
         QueryPlanOptimizer *qpo_;
         ContainerBase *container_;
         mutable IndexSpecification is_;
         mutable bool isFetched_;
    +     bool checkForSS_;
    class QueryPlan : public LocationInfo
    public:
         virtual ~QueryPlan() {}
         typedef enum {
              // Index lookups
    @@ -176,17 +179,17 @@ public:
         virtual const StaticAnalysis &getStaticAnalysis() const { return _src; }
         virtual QueryPlan *optimize(OptimizationContext &opt) = 0;
         virtual void createCombinations(unsigned int maxAlternatives, OptimizationContext &opt, QueryPlans &combinations) const;
         virtual void applyConversionRules(unsigned int maxAlternatives, OptimizationContext &opt, QueryPlans &alternatives);
         void createAlternatives(unsigned int maxAlternatives, OptimizationContext &opt, QueryPlans &alternatives) const;
         void createReducedAlternatives(double cutOffFactor, unsigned int maxAlternatives, OptimizationContext &opt, QueryPlans &alternatives) const;
    -     QueryPlan *chooseAlternative(OptimizationContext &opt, const char *name, bool noSequentialScan = false) const;
    +     QueryPlan *chooseAlternative(OptimizationContext &opt, const char *name) const;
         virtual NodeIterator *createNodeIterator(DynamicContext *context) const = 0;
         virtual Cost cost(OperationContext &context, QueryExecutionContext &qec) const = 0;
         /** Returns the QueryPlanRoot objects from the PathsQP in this QueryPlan */
         virtual void findQueryPlanRoots(QPRSet &qprset) const = 0;
         /// Returns true if it's sure. Returns false if it doesn't know
         virtual bool isSubsetOf(const QueryPlan *o) const = 0;
    @@ -536,20 +539,21 @@ protected:
         ImpliedSchemaNode *isn2_;
         QPValue value2_;
         DbWrapper::Operation operation2_;
    struct CostSortItem {
    -     CostSortItem(double cost) : qp_(0), cost_(0, cost) {}
    -     CostSortItem(QueryPlan *qp, OperationContext &oc, QueryExecutionContext &qec);
    +     CostSortItem(double cost, bool hasSS) : qp_(0), cost_(0, cost), hasSS_(hasSS) {}
    +     CostSortItem(QueryPlan *qp, OperationContext &oc, QueryExecutionContext &qec, bool checkForSS);
         bool operator<(const CostSortItem &o) const;
         QueryPlan *qp_;
         Cost cost_;
    +     bool hasSS_;
    #endif
    diff -ru dbxml-2.4.16-original/dbxml/src/dbxml/query/SequentialScanQP.cpp dbxml-2.4.16/dbxml/src/dbxml/query/SequentialScanQP.cpp
    --- dbxml-2.4.16-original/dbxml/src/dbxml/query/SequentialScanQP.cpp
    +++ dbxml-2.4.16/dbxml/src/dbxml/query/SequentialScanQP.cpp
    @@ -1,14 +1,13 @@
    // See the file LICENSE for redistribution information.
    // Copyright (c) 2002,2008 Oracle.  All rights reserved.
    -// $Id$
    #include "../DbXmlInternal.hpp"
    #include "SequentialScanQP.hpp"
    #include "StepQP.hpp"
    #include "QueryExecutionContext.hpp"
    #include "../ContainerBase.hpp"
    #include "../Document.hpp"
    @@ -134,16 +133,17 @@ QueryPlan *SequentialScanQP::optimize(Op
         return this;
    NodeIterator *SequentialScanQP::createNodeIterator(DynamicContext *context) const
    +     DBXML_ASSERT(container_->getContainerID() != 0);
         if(nodeType_ == ImpliedSchemaNode::METADATA) {
              return container_->createDocumentIterator(context, this);
         } else {
              NamedNodeIterator *result;
              if(nodeType_ == ImpliedSchemaNode::ATTRIBUTE) {
                   result = container_->createAttributeIterator(context,
                                                 this,
                                                 nsUriID_);

  • Temp table, and gather table stats

    One of my developers is generating a report from Oracle. He loads a subset of the data he needs into a temp table, then creates an index on the temp table, and then runs his report from the temp table (which is a lot smaller than the original table).
    My question is: Is it necessary to gather table statistics for the temp table, and the index on the temp table, before querying it ?

    It depends yesterday I have very bad experience with stats one of my table has NUM_ROWS 300 and count(*)-7million and database version is 9206(bad every with optimizer bugs) so queries starts breaking and lot of buffer busy and latch free it took while to figure out but I have deleted the stats and every thing came under control - my mean to say statistics are good and bad. Once you start collecting you should keep an eye.
    Thanks.

  • Tip for "Always On" Audio (possibly works on any Mac)

    Those users who have a preamp &/or headphones connected to their Mac will notice a distinct "click" when the power is applied/removed from the audio chip, when sound is called. And there’s always a lag when it turns on. This has gone on far enough.
    Here’s a very easy way to keep your sound chip from "sleeping":
    With your audio editor of choice, (such as Audacity), generate 30 seconds of silence, and export as an AIFF file. Save to your preferred location, as <Silent Loop>, or something.
    Open your preferred version of Quicktime Player, and open <Silent Loop>. Have the player just play the silence forever. No more clicks, because the chip is always "awake".
    Add your loop to "Startup Items", and set Quicktime player to play files when opened, as the "set and forget" default.
    This probably doesn't apply for audio via USB or FireWire.
    Perhaps Apple could add a "never sleep" option to Sound Preferences/Output?
    Message was edited by: MacSinceEightySix

    MacProCT wrote:
    There are two utilities that do something similar, but don't require having QT player open.
    http://www.ziksw.com/old_site/soundon/index.html
    http://mrfeinberg.com/KeepSoundAwake/
    I suspect SoundOn is more widely compatible, since it does not use a preferencepane.
    SoundOn just launched for me under osx 10.6 and stayed open. Didn't test its effectiveness (I'm not personally having a sound sleep problem).
    This technote:
    http://support.apple.com/kb/TA20726
    includes the following (emphasis added):
    In order to increase battery life, Mac OS X versions 10.1.2 through 10.1.5 turn off your computer's sound hardware when it is not used for 30 seconds. The delay in hearing sounds is the time it takes for the sound hardware to go from its low power mode to sound production.
    *One way to avoid this issue is by using external USB speakers.*
    Since this is a glitch that has “survived” through OS 10.6, I suppose that Apple has seen that a vast majority of users opt for USB and/or optical out, so they optimize bug-fixing “energy use” also.
    Since I use QuickTime pretty regularly, and the implementation of both of those “SoundOn” apps plays silence anyway, might as well just run Apple software in the background. It shows a minimal CPU usage/RAM footprint, and I suppose it’s the audio equivalent to Preview, which I load at startup as well.
    MS86
    Message was edited by: MacSinceEightySix

Maybe you are looking for

  • How to send a text file as jsp response

    Hi I want to send a text file/or other file as jsp response ..How to do it.. Pls tell me if any body knows about it.. thanks

  • An add-on disappeared

    I'm using 17.0.1. AdBlock Plus has disappeared on me, and I can't find it. I tried reinstalling it, but that didn't work. I went to the extensions list, but all I get is a blank page. I already tried going into my profile folder and removing the exte

  • Xmltype column design

    hi all, i've recently implementing a project which need to stored hierarchical data. since relational db alone can only offer flatfile and implementing hierarchical data using realtional table with design structure such as 1. MPTT(Modified Preorder T

  • Application title won't accept a "highlight"

    I bought into File Guard by Intego and the Application name in Finder in "applications" won't allow me to Highlight it with a color... What could be the cause of this (being that all my other application titles allow me to highlight them)? Any opinio

  • Crash of application using JDBC ODBC bridge

    Hello, Recently my java application started crashing everyday with this error: An unexpected exception has been detected in native code outside the VM. Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x77f8910e Function name=RtlEnterCri