Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-26 Thread Merlin Moncure
to all: maybe I can be of some help here. I think schemas are definately the way to go. I've used them quite a bit, previously with an accounting application which used schemas to separate company. Right now I am in development of a major project which will use them even more extensively, foll

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-26 Thread Alban Hertroys
Jorge Godoy wrote: Em Quarta 24 Maio 2006 13:06, Alban Hertroys escreveu: Jorge Godoy wrote: That's not what I showed above. What I meant was: CREATE TABLE base_schema.sample (); CREATE TABLE client1_schema.sample () INHERITS FROM base_schema.sample; ALTER TABLE client1_schema.sample RENAM

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-24 Thread Jorge Godoy
Em Quarta 24 Maio 2006 14:48, Richard Broersma Jr escreveu: > > From what I've read I am not sure that an Index created on the base/parent > table will help when preforming select queries on data across all of the > children. If I interpret the "Caveats" correctly I would assume that the > index w

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-24 Thread Richard Broersma Jr
> If I SELECT from the schema it will only retrieve data from the schema. If I > select from the parent table then I'll have all data available -- and for the > parent table I might need some date index. >From what I've read I am not sure that an Index created on the base/parent >table will he

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-24 Thread Jorge Godoy
Em Quarta 24 Maio 2006 13:06, Alban Hertroys escreveu: > Jorge Godoy wrote: > > > > But this could be easily done with two commands (besides creating indices > > again): > > > > ALTER TABLE x RENAME TO x_year; > > CREATE TABLE x () INHERITS FROM base.x; > > > > No need to change the rest... > > CRE

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-24 Thread Alban Hertroys
Jorge Godoy wrote: Em Quarta 24 Maio 2006 11:48, Alban Hertroys escreveu: Jorge Godoy wrote: Some things are really important here: - performance for operations on an individual company --- it has to be as fast as possible because this might be used by my client's clients.

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-24 Thread Jorge Godoy
Em Quarta 24 Maio 2006 11:48, Alban Hertroys escreveu: > Jorge Godoy wrote: > > Some things are really important here: > > > > - performance for operations on an individual company --- it has to be > > as fast as possible because this might be used by my client's clients. > > I suppose in

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-24 Thread Alban Hertroys
Jorge Godoy wrote: Em Quarta 24 Maio 2006 06:09, Alban Hertroys escreveu: What about using updatable views instead of inheritence? You'd need your company_id back, but adding new companies or modifying table definitions could be a lot easier (as long as you don't need to update all of your view

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-24 Thread Jorge Godoy
Em Quarta 24 Maio 2006 06:09, Alban Hertroys escreveu: > > What about using updatable views instead of inheritence? You'd need your > company_id back, but adding new companies or modifying table definitions > could be a lot easier (as long as you don't need to update all of your > views...). Hi Al

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-24 Thread Alban Hertroys
Jim C. Nasby wrote: Moving to -general, where it's more likely that others will have input. Perhaps the biggest issue is: what happens when you need to do DDL? If you have 1000 schemas that should be identical, you'll need to perform any DDL 1000 times. What about using updatable views instead

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-23 Thread Tom Lane
"Tony Wasson" <[EMAIL PROTECTED]> writes: > $.02 about lots of schemas. > I worked with an application that had 500 schemas and that worked very > well. However, as the number of schemas exceeeded 8000 the query speed > started to degrade. Running \d with a single schema in your search > path took

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-23 Thread Jorge Godoy
Em Terça 23 Maio 2006 20:26, Jim C. Nasby escreveu: > Moving to -general, where it's more likely that others will have input. Thanks Jim. This wasn't clear to me when I subscribed to the other mailing list. > One issue is that you'll probably be breaking new ground here a bit; I > suspect ther

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-23 Thread Jorge Godoy
Em Terça 23 Maio 2006 21:54, Tony Wasson escreveu: > > $.02 about lots of schemas. > > I worked with an application that had 500 schemas and that worked very > well. However, as the number of schemas exceeeded 8000 the query speed > started to degrade. Running \d with a single schema in your search

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-23 Thread Tony Wasson
On 5/23/06, Jim C. Nasby <[EMAIL PROTECTED]> wrote: > Is this a good idea? Would this be too bad, performance-wise, if I had > thousands of schemas to use like that? Any advice on better approaches? Any > expected problems? One issue is that you'll probably be breaking new ground here a bit;

Re: [GENERAL] [SQL] (Ab)Using schemas and inheritance

2006-05-23 Thread Jim C. Nasby
Moving to -general, where it's more likely that others will have input. On Tue, May 23, 2006 at 05:16:54PM -0300, Jorge Godoy wrote: > I'm modelling an application that will have data -- financial data, human > resources, etc. -- for several hundred (even thousands) of companies. This > is for