Is this currently an operational database where the data is just updated whenever it changes, rather than a new row being inserted?
If so, you could create a separate table and then take a "snapshot" of all the data by running a weekly script to copy the data into that table and add a timestamp.
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "Noob MySQL question - handling hostorical data (website stats)"
Collapse
-
It will import a new row each time the script is run.Originally posted by Jog On View PostThanks for that. Will it create a new row for each week and leave the previous rows as they were?
Depending how much of a programmer you are, you may be better looking at a free tool for web stats like AWSTATS. It can automatically query webserver and write stats away to mysql.Last edited by yorkshireman; 21 February 2011, 12:06.
Leave a comment:
-
I would have an audit table and set a trigger on update of the table to insert a new insert on the audit table. Probably the way I would do it.
Leave a comment:
-
Thanks for that. Will it create a new row for each week and leave the previous rows as they were?Originally posted by yorkshireman View PostHi Jog On,
I would have a field in the table called resultsdate make it a timestamp field. This will auto populate with the current time/date whenever you load data.
Leave a comment:
-
All I can answer that with is a lot of questions!
To save me shooting in the dark, I'll give you a break down of what you should be doing
Your best method will be to start off with building some prototype charts and graphs.
From these you can extract what you want to measure and the attributes which those measured will be grouped against.
Attributes will build into members - logical groups of members and from there you can build a hierarchy
By now you should be getting towards something that looks like a dimensionalised database.
Once you've got a semi decent logic and physical model you can then start to think about historical attributes.
Sounds like a lot of work but if you do it properly you'll see the benefits
Leave a comment:
-
Hi Jog On,Originally posted by Jog On View PostI'm building a MySQL database to store information on my websites such as traffic stats (from Google analytics), lead conversions and affiliate sales.
I've been searching and searching but can't find any useful info on how to best handle the historical data (I probably don't even know the search terms I should be using).
I want to update the DB each week and be able to keep the historical data so I can measure ongoing performance and draw my own graphs etc just like Google analytics but with conversion and revenue data as well.
What's the most effective and efficient way to update the DB each week and retain the previous data in each table? Some fields won't be updated but some will.
I would have a field in the table called resultsdate make it a timestamp field. This will auto populate with the current time/date whenever you load data.
Write a script to get your results preferably in csv format then call mysqlimport to import into your table.
Use cron to run your script weekly
Leave a comment:
-
Noob MySQL question - handling hostorical data (website stats)
I'm building a MySQL database to store information on my websites such as traffic stats (from Google analytics), lead conversions and affiliate sales.
I've been searching and searching but can't find any useful info on how to best handle the historical data (I probably don't even know the search terms I should be using).
I want to update the DB each week and be able to keep the historical data so I can measure ongoing performance and draw my own graphs etc just like Google analytics but with conversion and revenue data as well.
What's the most effective and efficient way to update the DB each week and retain the previous data in each table? Some fields won't be updated but some will.Tags: None
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- How a buyer’s market in UK property for 2026 is contractors’ double-edge sword Today 07:12
- Why PAYE overcharging by HMRC is every contractor’s problem Yesterday 06:26
- Government unveils ‘Umbrella Company Regulations consultation’ Feb 9 05:55
- JSL rules ‘are HMRC’s way to make contractor umbrella company clients give a sh*t where their money goes’ Feb 8 07:42
- Contractors warned over HMRC charging £3.5 billion too much Feb 6 03:18
- Statutory Sick Pay (SSP) for umbrella company contractors: an April 2026 explainer Feb 5 07:19
- IR35: IT contractors ‘most concerned about off-payroll working rules’ Feb 4 07:11
- Labour’s near-silence on its employment status shakeup is telling, and disappointing Feb 3 07:47
- Business expenses: What IT contractors can and cannot claim from HMRC Jan 30 08:44
- April’s umbrella PAYE risk: how contractors’ end-clients are prepping Jan 29 05:45

Leave a comment: