I've built a simple hit counter on my website (PHP & MySQL, using Codeigniter as my framework).
This is the table I use:
CREATE TABLE page_hits (id INT NOT NULL AUTO_INCREMENT, page_url VARCHAR(350) NOT NULL, ip VARCHAR(11) NOT NULL, hits INT NOT NULL, `date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, PRIMARY KEY (id));
On every page load, I check if the combination of page_url
& ip
exists in the table. If it does, I increment the value of hits
by 1. If not, I create a new row in the table. The timestamp is there to allow a certain delay between hit counts, so as not to count a page refresh as a new hit.
It all works nicely, but I'm afraid I might be overloading my database...
In less than 24 hours, I have over 6500 lines in the page_hits
table.
So my question is: What are the risks of having such a rapidly growing table in my database? (performance issues? exceeding database size limitation?)