On Jan 8, 1:00 pm, "Amir Michail" <[email protected]> wrote: > But how would you do this with a 24 hour rolling window?
My solution was for a simple fixed 24-hour chunks. But you could adapt it to store 24 fixed hourly chunks in each entity and a timestamp to identify the window. Then roll the data back by the proper # of hours on each transactional write. hourly_scores = [13, 0, 0, 18, 28, ...] # always 24 items hourly_score = 182 # sum of the 24 items hourly_hour = "2009010814" # YYYYMMDDHH The update logic involves shifting and pushing and some array shuffling, and summing the 24 values into hourly_score. But it's all still relatively straightforward. I believe this would accomplish the goal (approximating a rolling 24 hour window, with 1 hour granularity), and in a way that still only requires a single transaction for updates and a simple indexed query for fetching the results. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
