Zodiac1978 / wp-search-ignore-block-names

Modifies the native search to ignore block editor comments
https://wordpress.org/plugins/ignore-block-name-in-search/
GNU General Public License v2.0
4 stars 3 forks source link

Is REGEXP_REPLACE slow? #4

Closed Zodiac1978 closed 12 months ago

Zodiac1978 commented 1 year ago

I hope it is okay if I share this from your email @LinuxJedi? :

It should be noted though that it will not use any indexes so will run the regex on every row. So, without other filters there will likely be negligible performance difference between doing this on the database side and the client side (mostly the extra data transfer time and MariaDB's C++ doing the regex vs PHP execution time).

If you wanted to do it in a way that performs better, an index of keywords would be required. MariaDB has full text indexing in InnoDB for this. I don't know what MySQL does. But something custom could be written I suspect. Then you would just need to filter the results on the PHP side when you retrieve them so that the results that match inside the meta tags are filtered out

For this plugin, I'm just trying to fix the search problem and don't want to optimize the search in general. So I think for creating an own index would be overkill (Relevanssi and other plugins do this already) and if the performance difference is negligible I think I'm fine with my approach at this time.

Anything I can/should do on the plugin side to speed things up?

LinuxJedi commented 1 year ago

Absolutely fine with you sharing it :)