Icon View Incident Report

Serious Serious
Reported By: Brian Clingan
Reported On: 3/10/2015
For: Version 2.18 Build 3
# 4152 Query Dependencies Not Being Used Properly During Join Optimization

This is definitely one of the more complicated queries but we're seeing differences between 2.13b2 and 2.18b3.
AliasQry.sql

19 unique rows with 2.13
19 non-unique rows with 2.18

SELECT "ldto"."Wsn"
   , "ldto"."Lsn"      
   ,"iq"."Id"      
   ,(SELECT COALESCE("Locked", 0)        
      FROM   "DataLock" AS "dl"        
      WHERE  "dl"."Id" = "ldto"."Lsn"          
      AND ("dl"."Wsn" = "ldto"."Wsn"           
      OR  "dl"."Wsn" = -1)) AS "Locked"        
   ,"ldto"."Units"
   ,"ldto"."NumPts"
   ,"ldto"."Start"        
   ,"ldto"."Stop"
   ,"ldto"."Step"
   ,"ldto"."NullVal"
   ,"ldto"."MinVal"
   ,"ldto"."MaxVal"        
   ,"ldto"."Flags"
   ,COALESCE("ldto"."LasId", 0) AS "LasId"
   ,"ldto"."Mean"
   ,"ldto"."StdDev"  
FROM (SELECT "ldti"."Wsn"              
         ,"alci"."Id"              
         ,MIN("alci"."Seq") AS "MinSeq"        
      FROM "LogData" AS "ldti"        
      INNER JOIN "AliasLogCurve" AS "alci"          
         ON "ldti"."Lsn" = "alci"."Alias"         
         AND "alci"."Id" IN (323)        
      GROUP BY "ldti"."Wsn", "alci"."Id") AS iq
INNER JOIN "AliasLogCurve" AS "alco"    
   ON "iq"."Id" = "alco"."Id"   
   AND "iq"."MinSeq" = "alco"."Seq"  
INNER JOIN "LogData" AS "ldto"    
   ON "alco"."Alias" = "ldto"."Lsn"   
   AND "iq"."Wsn" = "ldto"."Wsn"  
ORDER BY "Wsn"



Comments Comments and Workarounds
The issue was with how the query optimizer was using the dependency information for the joins. It was allowing the joins to be re-ordered in a way that broke the dependencies and caused incorrect results. The workaround was to add the NOJOINOPTIMIZE clause to the end of the query.


Resolution Resolution
Fixed Problem on 3/10/2015 in version 2.18 build 4


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial
ElevateDB LCL Standard with Source
ElevateDB PHP Standard
ElevateDB PHP Standard with Source
ElevateDB PHP Trial
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image