We use prefix searches on the wb_terms table to show type-ahead suggestions in the entity selector widget. These queries are very slow for short prefixes (three or less characters takes about 15 seconds on the live cluster currently).
We should cache the results for short prefixes in memcached (per language). The actual result shown to the user is around ten entries long, so cache entries would be small. (we could be "randomized put" to approximate LRU behavior).
Note that slow queries may time out. In such a case, we should cache an empty result set, to avoid issuing the same expensive/slow query again.
When T86530 is implemented this task is obsolete.