Re: tablespace - datafile location

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: "Birchall, Austen" <austen(dot)birchall(at)metoffice(dot)gov(dot)uk>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: tablespace - datafile location
Date: 2013-08-15 14:53:53
Message-ID: 1376578433.21649.YahooMailNeo@web162906.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Birchall, Austen" <austen(dot)birchall(at)metoffice(dot)gov(dot)uk> wrote:

> Up to now I have been creating the sub-directories that (hold)
> the OS level files that are associated with individual
> tablespaces directly under the
>
> ..../psql/data directory i.e.
>
> db=# create tablespace test owner test_admin location
> '/var/lib/pgsql/data/test';
> Is this standard/best practise - I can see that the data
> directory could get 'cluttered' in a db that has many
> tablespaces.

I've never spent a lot of time browing the subdirectories.  Why
would "cluttered" matter?

> Is there a standard/recommended alternative for tablespace
> location for db which have many tablespaces?

It is not a good idea to put tablespaces under the $PGDATA
directory.  For one thing, it creates challenges for backup
software, which generally tries to copy everything under the
$PGDATA directory and then add everything from each non-default
tablespace.  Without a lot of care, you wind up copying everything
in every non-default tablespace twice.

Also, it doesn't really provide much benefit to use tablespaces
this way.  Unless the tablespace is on a separate filesystem, you
don't get any performance benefit, unless the type of filesystem
being used performs poorly with a large number of files in one
subdirectory.  If they are just being used for logical separation,
then separate schemas (namespaces) is a better way to do that.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Christofer C. Bell 2013-08-16 05:38:27 Re: sudo/access to the postres OS user
Previous Message Birchall, Austen 2013-08-15 14:18:23 Re: sudo/access to the postres OS user