pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: stan <stanb@panix.com>
To: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Isolation of multiple databse instances provided by a single postgres server
Date: Thu, 21 Nov 2019 15:51:16 +0100
Message-ID: <a5574835b147c2ba0d9d5d5891e8eae6b9e081f9.camel@cybertec.at> (raw)
In-Reply-To: <20191121115549.GA3417@panix.com>
References: <20191120220353.GA24554@panix.com>
	<db8bd3e1-7217-a66d-6113-2f402d89801c@gmail.com>
	<20191121115549.GA3417@panix.com>

On Thu, 2019-11-21 at 06:55 -0500, stan wrote:
> It seems to me that I can have one Postgres "server" running listening on a
> single port on a single machine. It appears that the data files for this
> "server" are managed internally by the Postgres server instance, and I
> have no control of what is stored where in them. In an Oracle world, I can
> create tablespaces, which have a relationship to OS files, and I can
> explicitly control what objects are stored in which tablespaces (OS file),
> thus, for example, when I do a hot backup, I put a specific tablespaces in
> backup mode, and can then safely copy this OS file (yes I have to properly
> deal with archive logs). Thus I would be somewhat comfortable have to
> distinct "instance: provided by that one Oracle "server".
> 
> It appears to me that, within this one Postgres "instance", there are 2
> levels of "isolation", which are database, and schemas. Is this correct? If
> so, how does this cores pond to physical on disk storage?

You can use tablespaces in PostgreSQL, which are directories on a
different file system, to put your data elsewhere.
But that has very limited use-cases, and normally you don't
create a tablespace.

About isolation:
- The different databases in a cluster are physically located in
  the same tablespace, but they are logically strictly separated.
  You cannot connect to one database and access another database from there.

- There can be several schemas in a database.
  You can access a table in a schema if you have the required privilege
  on both the schema and the table.

This is entirely independent of physical storage, which is provided
by tablespaces.  Tables from different databases can be located in the
same tablespace and vice versa.

Think of "database" and "schema" as a logical separation in SQL.

You cannot backup and restore an individual tablespace, only the
whole cluster.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (11+ messages)  latest in thread

Message-ID: <a5574835b147c2ba0d9d5d5891e8eae6b9e081f9.camel@cybertec.at>
Permalink:  ../a5574835b147c2ba0d9d5d5891e8eae6b9e081f9.camel@cybertec.at/
Also on:    postgresql.org/message-id/a5574835b147c2ba0d9d5d5891e8eae6b9e081f9.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, stanb@panix.com, ronljohnsonjr@gmail.com
  Subject: Re: Isolation of multiple databse instances provided by a single postgres server
  In-Reply-To: <a5574835b147c2ba0d9d5d5891e8eae6b9e081f9.camel@cybertec.at>
  References: <20191120220353.GA24554@panix.com> <db8bd3e1-7217-a66d-6113-2f402d89801c@gmail.com> <20191121115549.GA3417@panix.com> <a5574835b147c2ba0d9d5d5891e8eae6b9e081f9.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox