Does MySQL have limits for the amount of rows?
Moderator: General Moderators
-
impulse()
- Forum Regular
- Posts: 748
- Joined: Wed Aug 09, 2006 8:36 am
- Location: Staffordshire, UK
- Contact:
Does MySQL have limits for the amount of rows?
I had the idea to create a hit counter for my site by adding 1 to the number of rows in a table on each page loads. Will the table ever reach a limit? Is this generally bad scripting or not such a bad idea?
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
The limit varies on operating systems, it's in the millions/billions on any though.
Adding a row to a table on page hits is one of the worst ideas I've ever heard though. Just increment an integer in a field each page hit.
Adding a row to a table on page hits is one of the worst ideas I've ever heard though. Just increment an integer in a field each page hit.
Code: Select all
UPDATE `table` SET `hits` = `hits`+1- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
I believe the limit is dependant on the max file size allowed on the operating system. So I wouldn't say it can hold X amount of rows, but rather X amount of data.
To the OP.. that scripting is terrible
Do what was said above to simply increase an integer.
To the OP.. that scripting is terrible
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Hate to buck the trend*, but I would do this (and do do it) the way the OP is suggesting. A simple incrementing number doesn't tell you anything beyond the number of times the page has been viewed. If you add a record per hit (with things like the session id and page url (inc. variables)) you can track exact path a user has taken through your site with the amount of time spent on each page. That's very useful information.scottayy wrote:To the OP.. that scripting is terribleDo what was said above to simply increase an integer.
* I love to buck the trend.
-
impulse()
- Forum Regular
- Posts: 748
- Joined: Wed Aug 09, 2006 8:36 am
- Location: Staffordshire, UK
- Contact:
That worked a treat mate. I've gone back to logging each visitor as a row which includes the visitor number and IP. Does it get to the point in a PHP coders life when they stop patting themselves on the back for their creations because it all seems to have gotten old? I've only just started in the last few weeks and I find myself feeling really proud for the most simple thingsGM wrote:To get the IP Address it is extremely simple... look in the manual at the $_SERVER superglobal (specifically $_SERVER['REMOTE_ADDR'])