pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@depesz.com>
To: W.P. <laurentp@wp.pl>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Is it possible to keep indexes on different disk location?
Date: Thu, 18 Aug 2022 10:58:22 +0200
Message-ID: <20220818085822.GA12228@depesz.com> (raw)
In-Reply-To: <a5899b4c-e254-8a6c-4217-1b02d9430847@wp.pl>
References: <a5899b4c-e254-8a6c-4217-1b02d9430847@wp.pl>

On Thu, Aug 18, 2022 at 08:39:27AM +0200, W.P. wrote:
> Is it possible to move  DB tables etc to this internal storage (sure
> connection) and put only    indexes on USB  HDD?

Sure. There is a thing called tablespace, which is basically, directory
where files for db objects reside.

You can specify it both when making new objects
(https://www.postgresql.org/docs/current/sql-createtable.html,
https://www.postgresql.org/docs/current/sql-createtable.html) and you
can also move object between tablespaces (
(https://www.postgresql.org/docs/current/sql-altertable.html,
https://www.postgresql.org/docs/current/sql-altertable.html).

Just keep in mind that moving object means that it will get locked, data
copied to new device, and then removed from old, and unlocked.

> And will it help in case of losing connection to USB disk? (DB recoverable
> instead of total crash)?

Well, you need *all* data from all tablespaces to have fully working db.

Best regards,

depesz






view thread (5+ messages)  latest in thread

Message-ID: <20220818085822.GA12228@depesz.com>
Permalink:  ../20220818085822.GA12228@depesz.com/
Also on:    postgresql.org/message-id/20220818085822.GA12228@depesz.com

 · 

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: depesz@depesz.com, laurentp@wp.pl
  Subject: Re: Is it possible to keep indexes on different disk location?
  In-Reply-To: <20220818085822.GA12228@depesz.com>
  References: <a5899b4c-e254-8a6c-4217-1b02d9430847@wp.pl> <20220818085822.GA12228@depesz.com>

* 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