Jump to content

Very slow queries with custom MySQL function

Recommended Posts


I am currently developping a module which acts as a search engine for data I have in the database.

I retrieve data from the searched words by doing a query like this for each word : SELECT id, levenshtein_ratio("' . pQSL($word) . '", column_name) AS lev FROM ' . _DB_PREFIX . 'my_table
The table has 50 000 entries.
The levenshtein_ratio is a function I added in the database directly.

The thing is that when I run the query from my controller, it takes 11 seconds, but running from phpMyAdmin it takes on average 0.005 seconds.

I have several columns on which I would like to call the levenshtein_ratio function, but each time I use it it take 12 more seconds on average.

Does anyone have an idea on why it is so slow ?


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More