Hi hackers,

The ~ operator gets index conditions from a fixed pattern prefix, via
textregexeq_support(). regexp_like(), which is the same test, has no
support function and so misses out.

With no flags the two are identical, and like_regex_support() already
handles a FuncExpr, so the patch is just a prosupport entry plus a test.

1M rows, text column, btree index, C locale:
before: Seq Scan 255.094 ms
after: Index Only Scan, Index Cond on prefix 0.010 ms

I left the three-argument form alone: with 'n', '^' matches after a
newline, so a prefix range would miss rows. Handling flags needs its
own support function.

make check passes. Needs a catversion bump.

Regards,
Shihao

Attachment: 0001-Add-planner-support-function-to-two-argument-regexp_.patch
Description: Binary data

Reply via email to