Reimplement text_position and related functions to use Boyer-Moore-Horspool
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 7 Sep 2008 04:20:00 +0000 (04:20 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 7 Sep 2008 04:20:00 +0000 (04:20 +0000)
commit285966b76c1a3643f3d6f8f3da3609f98fd47150
treef7502f66d7029136c52af033fdddf67901980143
parent0dd5e2713d1770987b65bd92483a8a6411dcc9e0
Reimplement text_position and related functions to use Boyer-Moore-Horspool
searching instead of naive matching.  In the worst case this has the same
O(M*N) complexity as the naive method, but the worst case is hard to hit,
and the average case is very fast, especially with longer patterns.

David Rowley
src/backend/utils/adt/varlena.c