-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transWhere is very slow #581
Comments
Can you check if there are indexes on all the fields used in the where/join clauses of the query? |
Would you mind modifying the scopeTransWhere() method with the following for testing?
|
@mjauvin I replaced the code, ran it again and got the same result. It seems to produce the same query... Am I missing something? |
That's what you should expect, was just making sure. |
I've had the same problem with the scopeTransWhere, it gets very slow it there is more than a couple of thousand rows. I think that there should be a different scope method for searching only in the selected locale, not both in the default locale and the selected locale. |
@mterman would you be able to submit a PR for a NEW scope (we don't want to introduce a breaking change here)? Thanks. |
@mjauvin sure, I already did a quick test and it is noticeably faster. Need a better name for the scope, and test the scope in different situations.
|
Did you read this section of the Documentation? https://github.com/rainlab/translate-plugin/blob/master/README.md#indexed-attributes |
This PR is an alternative version of rainlab#586 Instead of creating a separate method that has a different behavior to the original implementation, I managed to fix ``transWhere`` itself by utilizing 2 queries instead of the slow orWhere clause. This implementation also preserves the fallback functionality. I made some tests on my project (originally discussed here: rainlab#581) - now I have 2 queries that execute in ~ 5 ms instead of a single 60 second query. The improvement is significant. Comments are welcome.
In one of my projects I've noticed that
transWhere
can become very slow. I don't have a solution for this issue yet (except for running 2 separate queries), so I'm posting it here in hopes that someone else might have an idea.I have a query like this:
The resulting query is:
In my tests it can take up to 97 seconds to execute:
I have tested on two different database systems with similar results:
There are 7k rows in
sp_catalogue_products
table and 8k rows inrainlab_translate_indexes
, so the amount of data is not huge.The text was updated successfully, but these errors were encountered: