Re: dynamic tablenames

Russell Norris
Tue, 23 Jan 2007 16:54:06 -0000

This is incredibly great news for me! Thanks so much Luca and thanks Piet
for bringing up what I''m just now getting around to coding.

RSL

On 1/23/07, Luca Mearelli
<lucamea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
>
> Nothing from one request is shared with another one (it''s the
basis of
> the "shared nothing" architecture) *.
>
> If you use a before_filter on the controller you should be ok (this is
> also how acts as authenticated works)
>
> bye
> Luca
>
> * with he exception of the session data which is shared by all the
> requests coming from the same browser session.
>
> 2007/1/23, Russell Norris
<sconds-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> > I''m doing a similar thing [setting information about the
database
> > on-the-fly] but I''m having to change a model''s
table_name_prefix. The
> one
> > concern I have [though it hasn''t come up so far] is the
possibility of
> two
> > requests being made at the same or close to the same time and one
> mistakenly
> > using the others'' setup. I''m thinking of using
transactions, perhaps. I
> > dunno but I too am interested in if anyone else has done on-the-fly
type
> > database configuring.
> >
> > RSL
> >
> >
> > On 1/23/07, Piet Hadermann
<piet.hadermann-/1BeJOKqmzrQT0dZR+AlfA@public.gmane.org> wrote:
> > >
> > >
> > > Hi List!
> > >
> > > May I tap into your combined common sense ?
> > > I have a legacy logging app that needs to be modernized. At the
> moment,
> > Data is going to be stored in 5 tables, one table is going to contain
> more
> > than 200 million and 2 others about 60 million rows. Mysql will be
used,
> > unless someone sees a major advantage in using something else (at the
> moment
> > data is stored in a raw positioned file format, which I''m not
keeping).
> > >
> > > For performance reasons I''m thinking about storing the
data for each
> > entity in separate tables. So instead of a ''logdata''
table with >200
> million
> > rows, I''d create ''logdata_001'',
''logdata_002'',... tables where the
> rowcount
> > of even the biggest entity logdata stays below 3 million.
> > >
> > > Rails seems to have no problem with me setting the tablename
> > (set_table_name) on each incoming request before accessing the
database.
> > > I have this gut feeling though I''m overlooking something
nasty.
> > > Anyone have any comments/suggestions ? Am I about to create my
own
> > personal maintenance nightmare ?
> > >
> > > Thanks in advance for your insights!
> > >
> > > Piet.
> > >
> > >
> > >
> >
> >
> >  >