Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Osclass Search - important SQL query optimization #2293
Few months ago I was investing something interesting about performance and potential search optimization, and the whole reason for that is this topic by Syed from the forum:
Long story short, I found help from guys at EverSQL and especially their CEO and co-founder Tomer Shay. With his help, the slow query was optimized and speed-up by a factor x2 or x3 in some cases.
This is my reply / excerpt from the forum:
With my similar laptop configuration (4 cores, 4 GB RAM etc.) and localhost (not live server), and no extra plugins, I got similar times for sql part:
The slowest queries are this one in all cases:
This is what takes the most of the time in search pages & latest items w/wo photos.
Now, back to my work with EverSQL, we focused on this one (slowest case) -- this is the original non-optimized query:
And this is what EverSQL come up with:
modify table / add index:
Later, we concluded that straight_join can be omitted, thus avoiding potential problems. Speed gain still applies.
I have sent to Osclass Team my test database and results, reduction in exec time is obvious (down from 0.6-0.7 seconds to under 0.3 seconds).
We should consider applying this changes in the DAO class and database.