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 EV tax changes of 2025-2028 add up for contractor limited company directors Today 08:11
- Under the terms he was shackled by, Ray McCann’s Loan Charge Review probably is a fair resolution Yesterday 08:41
- Contractors, a £25million crackdown on rogue company directors is coming Jan 26 05:02
- How to run a contractor limited company — efficiently. Part one: software Jan 22 23:31
- Forget February as an MSC contractor seeking clarity, and maybe forget fairness altogether Jan 22 19:57
- What contractors should take from Honest Payroll Ltd’s failure Jan 21 07:05
- HMRC tax avoidance list ‘proves promoters’ nothing-to-lose mentality’ Jan 20 09:17
- Digital ID won’t be required for Right To Work, but more compulsion looms Jan 19 07:41
- A remote IT contractor's allowable expenses: 10 must-claims in 2026 Jan 16 07:03
- New UK crypto rules now apply. Here’s how mandatory reporting affects contractors Jan 15 07:03

Leave a comment: