mysql - FIND_IN_SET() alternative? -


i have query looks like:

select [column a], [column b], [column c], [column d] [table]  find_in_set(2, column d) order [column a] desc 

where [column d] of type varchar, , holds set of numbers (ex, 3, 2, 4, 6, 1, 9). trying return records 2 in set of numbers. however, when execute explain on above query, output:

id  select_type table   type    possible_keys   key     key_len     ref     rows        1   simple      [table]     null            null    null        null    500000      using where; using filesort 

this query not seem using indices during execution of query. [column a] primary key, there index on column already. there way utilize index query run faster? or there way me improve performance of query?

alternative: normalize schema.

find_in_set not sargable , index cannot used.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -