SAP Knowledge Base Article - Preview

3310161 - Optimizer chooses ignores existing index when local variables are used as search arguments - SAP ASE

Symptom

  • Optimizer does not use an existing index when local variables are used, but it does use the index when the SARG is hardcoded
  • the select statement contains a WHERE-CLAUSE with the 'LIKE' operator in the following form

          FirstName like @fname+'%' and LastName like @lname+'%' and  ..

  • The query ignores using the appropriate index and takes longer to execute
  • Trying to force the index causes a Forward Scan with Positioning at start of table.  


Read more...

Environment

ASE 16.0

Product

SAP Adaptive Server Enterprise all versions

Keywords

LIKE, slow query, drop, performance, local variable, tablescan, indexscan, "statement cache"  , KBA , BC-SYB-ASE , Sybase ASE Database Platform (non Business Suite) , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.