Re: how to create multiple databases running in different dirs

From: John W Higgins <wishdev(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: how to create multiple databases running in different dirs
Date: 2014-07-02 23:56:21
Message-ID: CAPhAwGxM+4a56vM9-rPie4bw+tgxnE=x14q80yeCi_qy4bntqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Afternoon Frank,

I believe what you might wish to look at is a single database with a set of
schemas[1] which would separate your data in a logical way. You could have
a single connection url and then each individual connection could create a
schema (or reuse if you wish), set the search path (first example here [2])
and populate the schema (if needed) within your single database

That would give you your desired isolation but within a simple framework
that is PostgreSQL friendly.

John

[1] - http://www.postgresql.org/docs/9.3/static/ddl-schemas.html
[2] - http://www.postgresql.org/docs/9.3/static/sql-set.html

On Wed, Jul 2, 2014 at 4:24 PM, frank ernest <doark(at)mail(dot)com> wrote:

> > how would an instance of your program know what to connect to, or which
> > previous instance its 'predecessor' was ?
> > normally, you have ONE database for a given set of applications, and all
> > the applications share the same database tables and such.
>
> That's the problem, is there some way to tell pgsql "Go to dir X, open
> your data base Y and prepare for connections at adress Z and port P"? And
> could pgsql accept multiple connections on the same address and port? I was
> thinking of using my pID but that would change and if I used a user created
> string then if I started only on a single instace of pgsql and pointed it
> to it's databases the user might get the strings duplicated and that would
> be no good. I also thought of naming each database with a name generated by
> using the uuid library but I'm not sure which would be best.
>
> If I choose to have multiple servers running on the same machine how would
> my program start them?
>
> > Is each runtime instance of your application to have a new, empty
> > database? No data from any other run of the application?
>
> No, the dynamically generated content is to be dropped (drop table
> dynamic_content;) but the rest is to be preserved. The idea is to create a
> database of a file system but the files contain no data, I only want their
> metadata and I will add a few additional metadta values to each file.
>
> Thanks, David
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2014-07-03 01:29:04 Re: how to create multiple databases running in different dirs
Previous Message frank ernest 2014-07-02 23:24:34 Re: how to create multiple databases running in different dirs