How to Use an Index for Suffix Queries (Doc ID 1439979.1)

Last updated on FEBRUARY 26, 2017

Applies to:

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

Goal

MySQL does not support suffix indexes. The MySQL indexes can only be used match prefixes such as :

select * from t where c like 'prefix%'


But the below query can not use an index :


select * from t where c like '%suffix'


This document provides a workaround.

Solution

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms