"David Johnston" <polobo@xxxxxxxxx> writes: >> while it might work to reverse the order in a regex, I have experienced >> severe slowdown when the pattern comes from table data > If it is indeed related to the custom reverse query the fact that you are > going through an SQL wrapper to access a c-level function is inevitably > going to degrade performance. I believe that in most situations of interest, the SQL wrapper would get "inlined" and thus create no significant per-row penalty. It's possible this isn't happening in some specific case, but as you say we'd need to see a concrete example to know one way or the other. Another point that comes to mind is that "pattern comes from table data" probably means "query uses a whole lot of different patterns over its lifetime". Each different pattern is going to require regex compilation, which is not a particularly cheap operation. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general