My Oracle Support Banner

A Query Does Not Use Expected Indexes When Comparing a Field to a Variable (Doc ID 2242395.1)

Last updated on MARCH 09, 2017

Applies to:

MySQL Server - Version 5.1 and later
Information in this document applies to any platform.

Symptoms

 A query which compares a string field (CHAR, VARCHAR, or TEXT) to a constant uses an index on that field. A similar query inside a stored procedure or function fails to use the index when comparing the field to a local variable.

For example, this query may use an index:

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.