mysql: efficient way for postfix-search (like '%text' aka. prefix wildcard)?

后端 未结 2 1867
庸人自扰
庸人自扰 2020-12-31 19:21

Is there any build-in functionality in MySQL to do the above without scanning the entire table?

Only solution I found is to store a mirrored version of the column I

2条回答
  •  梦谈多话
    2020-12-31 19:31

    MySQL won't use an index when your value starts with a wildcard character.

    Storing a second column in reverse order is a defensible approach. It will fail on a suffix, though.

    If you know the compounded words, you can pre-compute "valuable to know" matches and store them in another table. I think that's unlikely to work well for a German dictionary, but you might know something I don't.

提交回复
热议问题