I may have fallen into Knuth's fundamental warning and optimized
prematurely.

My database has various foreign keys which are there to try and speed
things
up but they take time to maintain as well. Now I'm wondering if they
are worth the time to maintain verses the time they save.

Does anyone know of a GEM that instruments ActiveRecord? For example,
it could increment a counter per association each time it is traversed
(used) and a different counter each time it is assigned. And then some
way to cause these counters to be dumped out and reset at the end of
some length of time like a day or a week.

Seems like it would be rather easy to implement and handy to have.

Thank you,
pedz

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Frederick Cheung at Dec 19, 2011 at 6:34 pm

    On 19 Dec 2011, at 17:00, Perry Smith wrote:

    I may have fallen into Knuth's fundamental warning and optimized
    prematurely.

    My database has various foreign keys which are there to try and speed
    things
    up but they take time to maintain as well. Now I'm wondering if they
    are worth the time to maintain verses the time they save.

    Does anyone know of a GEM that instruments ActiveRecord? For example,
    it could increment a counter per association each time it is traversed
    (used) and a different counter each time it is assigned. And then some
    way to cause these counters to be dumped out and reset at the end of
    some length of time like a day or a week.
    I don't know of any gem that does that but I think that if you were to do such monitoring you would be better of doing it at the database level than at the active record level - I'd start by looking for profiling tools for your database

    If all you've done is add foreign keys to your various _id columns it feels unlikely that you'd have too many indices. Plus, full table scans really really suck unless your tables are really tiny (and if they are that tiny I wouldn't think you'd have performance reasons)
    Foreign keys are also there for data integrity reasons, not just speed.

    Fred

    Seems like it would be rather easy to implement and handy to have.

    Thank you,
    pedz

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 19, '11 at 5:01p
activeDec 19, '11 at 6:34p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Perry Smith: 1 post Frederick Cheung: 1 post

People

Translate

site design / logo © 2021 Grokbase