RigacciOrg/AirPi

Cannot access Calendar history

RigacciOrg opened this issue · 1 comments

The AirPi station is running for a long time (about one year), so the SQLite database /var/lib/airpi/airpi-data.db is grown to about 300 Mb in size. When I click on the Calendar page, the page remains blank, where the Nginx error log says something about:

PHP Fatal error: Maximum execution time of 30 seconds exceeded

may be the data extraction from database is not optimized.

The query over the SQLite datbase was not well optimized, so it required more than 30 seconds (default PHP timeout).

The problem should be fixed by commits 523a51e, 66e8205 and 2f76cac (updated files lib/airpi-data-export, lib/airpi-sql-insert and html/getpmdata.php).
Unfortunately a new index must be created into the database, this will increase the size (e.g. from 376 Mb a 478 Mb in my test case). To add the index, run this command (it requires some minutes to complete):

sqlite3  /var/lib/airpi/airpi-data.db
CREATE INDEX data_type_timestamp_idx ON data (type, timestamp);