-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Improve query speed #1053
Comments
Hi Raymond Thank you for your message.
Yes, don't use pagination. Identify the last PK you have and ask for new records or use another field to match (with index) instead of pagination. Pagination requires sequential scanning.
Use this to get all records of today and add hours if needed. Kind regards, Maurits |
Hi Maurits, Thank you for your speedy reply :) This makes a HUGE difference. Now it takes for one hour of log entries around 180ms! Two questions that I am curious of:
Kind regards, |
Hi Raymond, Great to hear that your results are good!
No
Yes, the default solution is to use deflate/gzip on the webserver (nginx or apache) that executes the PHP script and the expected compression ratio is roughly 1:10 (sometimes even better). One could also achieve this from within PHP, but I see no (direct) reason why that would be preferred. see: https://tecadmin.net/enable-gzip-compression-apache-ubuntu/ Kind regards, Maurits |
Hello again @mevdschee,
Thank you again for developing this amazing API and dedicating your efforts to it.
Right now we have four machines (portable water purification) running.
For all kinds of logging every machine has a MySQL server and webserver running. Every 5 seconds a log is added.
Monitoring is done through a locally running website after logging on the machine.
At this moment we have around 1.000.000 records in the LOG table. When I want to retrieve the latest logging results I use a query as this:
/api.php/records/log?order=date,desc&page=1,720 (720 is for hone hour of log entries) and this takes around 3 seconds. What I don't understand is why this seems independent of the page size (1000 in this example). The response time for 72, 7200 or 72.000 as page size it is the roughly 3 seconds.
I added an index to the date column already (otherwise response time would be minutes).
Is there a way to speed up response times?
Looking forward to hearing from you.
The text was updated successfully, but these errors were encountered: