That's a good question, I can link you the SQLite LIKE optimization code, but it's dense, and there's a heading in their public non-code documentation about what the optimization tries to achieve. In practice I've triggered it with that example and it seems having the wildcard in the middle of the operand with equivalent prefixes is the trick.