View Single Post

   
  #5 (permalink)  
Old 02-27-2008, 03:09 AM
Gert van der Kooij
 
Posts: n/a
Default Re: Why is this happening in `Enable Query Optimization`

In article <1110683719.132452.33100@l41g2000cwc.googlegroups. com>,
(ak_tiredofspam@yahoo.com) says...
> Gert,
>
> I guess that during compilation of
> select * from emp where sex = 'q'
> the optimizer recognized the check constraint sex in ('m','f') and
> eliminated the select altogether. Should the constraint be enforced, no
> rows would meet the search criteria sex = 'q'. The optimizer has acted
> as if the constraint were enforced, which is exactly as it should.
>
> Regarding
> select * from emp where sex <> 'm'
> I guess the execution plan was tablespace scan, matching rows against
> the search criteria
> sex <> 'm'
>
> I don't see any problem here, all worked as it should.
>
> What do you think?
>
>


You should read the first post
I didn't have a problem, it was Thiru (a.k. WantedToBeDBA) who had a
problem when running the last SQL, it returned an 'x':

>>db2 => select * from emp where sex <> 'm'
>>
>>EMPNO SEX
>>----------- ---
>> 2 f
>> 3 x
>>
>> 2 record(s) selected.
>>

Reply With Quote