On May 24, 6:17 pm, Youyou Semsem <[email protected]>
wrote:
> Hi guys,
>
> I have a model Post which has a expiry_date. I want to know what is the
> best way to manage scalability in this case. 2 options:
>
> 1. Whenever I want to SELECT from the table, I need to include where
> expiry_date > NOW. If the table Post grows like a monster, I will be in
> trouble. Imagine after 3 years or more. Indexes will be huge too.
>
You could have a table with millions of rows and such a query would be
fast (as long of course as you had an index on the expiry_date
column). Not to say that moving expired posts somewhere else wouldn't
necessarily be a bad idea but certainly not something I would do
preemptively
Fred
> 2. Have a trigger, cron job, or a plugin (if it exists) that would go
> around the table and move expired items to a new table Post_Archive.
> That way, I maintain only current Posts in my main table, which implies
> that over 3 years I won't be as bad as option 1.
>
> Any help? comments from your experience?
>
> Thanks,
> Youssef
> --
> Posted viahttp://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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---