Re: Is it possible to keep indexes on different disk location?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: "W(dot)P(dot)" <laurentp(at)wp(dot)pl>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Is it possible to keep indexes on different disk location?
Date: 2022-08-18 08:58:22
Message-ID: 20220818085822.GA12228@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2022-08-18 09:00:44 Re: Unable to Create or Drop Index Concurrently
Previous Message Ivan N. Ivanov 2022-08-18 07:32:26 Re: [(catch-ext)] Re: Setting up streaming replication on large database (20+ TB) for the first time