Quantcast
Channel: SCN: Message List - SAP Adaptive Server Enterprise (SAP ASE) for Custom Applications
Viewing all articles
Browse latest Browse all 3587

Re: False condition in WHERE clause

$
0
0

Hi Mike

 

I have just succeeded to reproduce the problem on another customer site on ASE 15.7 SP60. See the output of "sp_options show" attached. You mentioned that you receive different results in your tests - could you share some details?

 

The index scan appears so expensive because the optimizer doesn't recognize the first condition and therefore assumes that a full index scan will be required, which is expensive. If I omit the second, always false condition then an index scan on item_number is used and the query returns very fast (4 LIO), as expected.

 

Also, if I replace the always false condition with another false condition related to the indexed column, such as " and packages.item_number = -1" (there are no such records for sure), then the optimizer recognizes both conditions, applies an OR optimization strategy and the query returns very fast.

 

Thanks

Leonid Gvirtz


Viewing all articles
Browse latest Browse all 3587

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>