On 7/18/08, Jason Yergeau <[EMAIL PROTECTED]> wrote:
>
> Hi Rob ---
>
> MySQL 5.
>
>
>
> On Fri, Jul 18, 2008 at 3:01 PM, Rob Wultsch <[EMAIL PROTECTED]> wrote:
> > On Fri, Jul 18, 2008 at 2:00 PM, Jason Yergeau <[EMAIL PROTECTED]>
> wrote:
> >> I'm having trouble working through a data problem.  Any tips or
> >> keywords that might clue me into a known pattern would be incredibly
> >> appreciated!
> >>
> >> I have about 500,000 users in my system.  Each user has a points
> >> balance, updated by a system over which I have no control.  I'd like
> >> to track changes to each user's point balance over time by taking
> >> timestamped snapshots of their balance, and saving it into a new
> >> table.
> >>
> >> It's easy to take the snapshot:
> >>
> >> insert into balances (userid, points) select userid, points from users;
> >>
> >> This quickly takes the points field from my users table, and saves it
> >> into a balances table, which saves the data along with a timestamp.  I
> >> can run that query on a regular basis without overly taxing my system.
> >>
> >> The first time its run, I get 500,000 rows of data.  That's fine.  But
> >> the next time I run a query, I only want to save the differences in
> >> balance.
> >>
> >> Anyone have any tips?
> >>
> >> Best,
> >> Jason
> >
> > What version of mysql do you need this to work with?
>


I may be wrong, but I think you could accomplish this through the use of
triggers.  Triggers are designed to monitor data change activity.

-jp

-- 
Broken promises don't upset me. I just think, why did they believe me?

deepthoughtsbyjackhandy.com

Reply via email to