[LRUG] Using statistical tables with Rails

Viktor Tron viktor.tron at gmail.com
Fri Sep 23 03:53:41 PDT 2011


It sounds like you need an audit trail.

https://github.com/laserlemon/vestal_versions
http://github.com/collectiveidea/acts_as_audited
https://github.com/airblade/paper_trail
http://stackoverflow.com/questions/2323505/how-to-keep-track-of-model-history-with-mapping-table-in-ruby-on-rails

These plugins all use a single version table polymorphically linking to  
audited models.
I guess most implements proper versioning with rollback etc which you  
don't need to use.

If you want to implement efficient queries on the changes you will  
probably need
something like solr/xapian, since they are prob stored as yamled hash.
I know there are gems that do this.

hth

On Fri, 23 Sep 2011 11:37:18 +0100, Neil Middleton  
<neil.middleton at gmail.com> wrote:

> I'm building an app that needs to store a fair amount of events that the  
> users carry out. (Think LOTS as in millions per month).
>
> I need to report on the these events (total of type x in the last month,  
> etc) and need something resilient and fast.
>
> I've toyed with Redis etc to store aggregates of the data, but this  
> could just mean that I'm building up a massive store of single figure  
> aggregates that aren't rebuildable.
>
> Whilst this isn't a bad solution, I'm looking at storing the raw event  
> data in tables that I can then query on a needs basis, and potentially  
> generate aggregate counters on a periodic basis. This would thus give me  
> the ability to add counters over time, and also carry out ad-hoc  
> inspections on what is going on, something which aggregates don't allow.
>
> Question is, how is best to do this? I obviously don't want to have to  
> create a model for each table (which is what Rails would prefer), so do  
> I just create the tables and interact with raw SQL on a needs basis, or  
> is there some other choice for dealing with this sort of data?
>
> It would be interesting to know what thoughts you guys have.
>
> Cheers
>
> Neil
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org



More information about the Chat mailing list