Hi all. A few months ago, I coded a PHP/MySQL script that determined the “most popular” searches on my site. Apparently the way I did it is quite resource intensive —even though the site overall is pretty simple and efficient — and my database access has been temporarily restricted at my host. My skills in this area may not be strong enough to resolve the problem. Can you please assist?
Here is the thread where I developed the solution. And below that is the email I received from my host.
[quote]Unfortunately, we have been forced to temporarily restrict access to MySQL for username
on gator4173.hostgator.com. Please take a moment to review this email in full as it contains important information and resources to assist you in resolving this issue. Please note that while this restriction is temporary, you should take actions to resolve the issue(s) which may have caused it in order to avoid further down-time/permanent restrictions.
-
How can you resolve the issue?
We have two solutions available. Moving the account to a dedicated server, which will allow far greater hardware resources or you may try following the basic recommendations for optimizing your database. If you feel your database has already been optimized, it may simply be time to consider the hardware upgrade. http://support.hostgator.com/articles/specialized-help/technical/optimize-mysql-resource-usage -
Why did this happen?
Per our terms of service (http://www.hostgator.com/tos) a single hosting account may use no more than 25% of the entire server’s resources. Accounts are typically not actively restricted until they exceed those resource limitations exceptionally. Unfortunately, in this instance, we were forced to place a temporary restriction on your user to prevent service issues with the server’s over-all system performance. For more information about resource usage limitations, please see:https://support.hostgator.com/articles/pre-sales-policies/rules-terms-of-service/account-limits-summary
Please reply to this email once you have determined a resolution to this issue.
CPU_TIME:195 table_rows_read:356971695 SELECTS:8342 ROWS_UPDATED:14 ROWS_FETCHED:240842 BUSY_TIME:200 ONNECTED_TIME:252 BYTES_SENT:0 BYTES_RECEIVED:2526383 WAIT_TIME:5
Top table row reads:
DB_USER: username
– TOTAL_CONNECTIONS: 1689 – CONNECTED_TIME: 252 – CPU_TIME: 195 – TABLE_ROW_READS: 356971695 – SELECT_COMMANDS: 8342 – UPDATE_COMMANDS: – BUSY_TIME: 200 – BYTES_SENT: 0 – BYTES_RECEIVED: 2526383 – WAIT_TIME (IO): 5
Top WAIT (IO) TIME:
DB_USER: username
– TOTAL_CONNECTIONS: 1689 – CONNECTED_TIME: 252 – CPU_TIME: 195 – TABLE_ROW_READS: 356971695 – SELECT_COMMANDS: 8342 – UPDATE_COMMANDS: – BUSY_TIME: 200 – BYTES_SENT: 0 – BYTES_RECEIVED: 2526383 – WAIT_TIME (IO): 5
username 54673 0.0 0.0 300932 16000 ? RN 19:56 0:00 /usr/bin/php /home3/username/comparewear/comparison.php
Wed Nov 9 19:56:29 CST 2016
Running Processes:
username
54673 0.0 0.0 301192 16832 ? SN 19:56 0:00 /usr/bin/php /home3/username/comparewear/comparison.php
Running Queries:
*************************** 1. row ***************************
USER: username
DB: dbname
STATE: Copying to tmp table
TIME: 1
COMMAND: Query
INFO: SELECT comparisons_created.pid, comparisons_created.cid, categories.category, products.hide, products.url_id, products.shortname, products.brand, products.product, products.category_singular
FROM comparisons_created
INNER JOIN products on products.pid = comparisons_created.pid
INNER JOIN categories on categories.cid = comparisons_created.cid
WHERE comparison_new_datetime > ‘2016-11-06 19:56:29’
AND comparisons_created.cid = ‘1’
GROUP BY comparisons_created.pid
ORDER BY count(comparisons_created.pid) DESC
LIMIT 20[/quote]
Thanks!