-
Notifications
You must be signed in to change notification settings - Fork 49
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
int (ID) is enclosed in quotes when using WHERE #230
Comments
Running a few queries resulted in an overall 16% of query time decrease. Note that |
There's also this optimization here: osclass/Osclass#2293 |
No changes have been made yet regarding that? I think just the INDEX they mentioned would help a lot. I'm working on optimizing some plugins on a large site and just by adding some good indexes the speed of queries was increased significantly. |
Nope. But, optimized query is not exactly the same, so adding index alone isn't good enough IIRC. |
Agree, but until we start working with optimizing the DAO classes, index is very easy to add. |
Yes, that part is easy :) |
@webmods-croatia It would be better to compare it against the allowed characters. BTW I tried to run both queries with EXPLAIN and I didn't found any performance-related issue due to quotes nor I find any documentation related to performance impact. EXPLAIN Select * from oc_t_item where fk_i_category_id = '31'
EXPLAIN Select * from oc_t_item where fk_i_category_id = 31
As you can see in above case both queries are using indexes. |
@navjottomer I ain't an expert with this, but that's what EverSQL told me. The performance difference is there. |
Can you share the report? If the performance difference is there then we should see the whole example. |
Closing this for now. |
$this->dao->where('t.i_thread_id', $thread_id');
results in:
WHERE t.i_thread_id = '22745'
$this->dao->where("t.i_thread_id = $thread_id");
results in:
WHERE t.i_thread_id = 22745
This hurts performance and doesn't allow indexes to function well. We should check if where argument is a number and remove quotes in that case.
The text was updated successfully, but these errors were encountered: