pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Is it possible to keep indexes on different disk location?
5+ messages / 4 participants
[nested] [flat]

* Is it possible to keep indexes on different disk location?
@ 2022-08-18 06:39  W.P. <laurentp@wp.pl>
  0 siblings, 2 replies; 5+ messages in thread

From: W.P. @ 2022-08-18 06:39 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hi there,

I have a PostgreSQL 11 server on OrangePi3 (ARM 64 bit, Armbian, PG from 
distro).

Database (all cluster) is located on USB disk. This approach give me 
already 2 times loosing DB contents (it is a replica of DB on i7).

But the whole thing (mainly indexes) is about 50G, and internal storage 
is only 32GB.

Is it possible to move  DB tables etc to this internal storage (sure 
connection) and put only    indexes on USB  HDD?

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


Laurent






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Is it possible to keep indexes on different disk location?
@ 2022-08-18 08:58  hubert depesz lubaczewski <depesz@depesz.com>
  parent: W.P. <laurentp@wp.pl>
  1 sibling, 0 replies; 5+ messages in thread

From: hubert depesz lubaczewski @ 2022-08-18 08:58 UTC (permalink / raw)
  To: W.P. <laurentp@wp.pl>; +Cc: pgsql-general@lists.postgresql.org

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






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Is it possible to keep indexes on different disk location?
@ 2022-08-18 14:46  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: W.P. <laurentp@wp.pl>
  1 sibling, 1 reply; 5+ messages in thread

From: Laurenz Albe @ 2022-08-18 14:46 UTC (permalink / raw)
  To: W.P. <laurentp@wp.pl>; pgsql-general@lists.postgresql.org

On Thu, 2022-08-18 at 08:39 +0200, W.P. wrote:
> I have a PostgreSQL 11 server on OrangePi3 (ARM 64 bit, Armbian, PG from 
> distro).
> 
> Database (all cluster) is located on USB disk. This approach give me 
> already 2 times loosing DB contents (it is a replica of DB on i7).
> 
> But the whole thing (mainly indexes) is about 50G, and internal storage 
> is only 32GB.
> 
> Is it possible to move  DB tables etc to this internal storage (sure 
> connection) and put only    indexes on USB  HDD?
> 
> And will it help in case of losing connection to USB disk? (DB 
> recoverable instead of total crash)?

I'd say that that is a bad idea.  It would not be easy to recover from
losing a tablespace, even if it contains only indexes.

Get a real computer.  Take backups regularly.

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





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Is it possible to keep indexes on different disk location?
@ 2022-08-18 19:54  W.P. <laurentp@wp.pl>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 5+ messages in thread

From: W.P. @ 2022-08-18 19:54 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

W dniu 18.08.2022 o 16:46, Laurenz Albe pisze:
> On Thu, 2022-08-18 at 08:39 +0200, W.P. wrote:
>> I have a PostgreSQL 11 server on OrangePi3 (ARM 64 bit, Armbian, PG from
>> distro).
>>
>> Database (all cluster) is located on USB disk. This approach give me
>> already 2 times loosing DB contents (it is a replica of DB on i7).
>>
>> But the whole thing (mainly indexes) is about 50G, and internal storage
>> is only 32GB.
>>
>> Is it possible to move  DB tables etc to this internal storage (sure
>> connection) and put only    indexes on USB  HDD?
>>
>> And will it help in case of losing connection to USB disk? (DB
>> recoverable instead of total crash)?
> I'd say that that is a bad idea.  It would not be easy to recover from
> losing a tablespace, even if it contains only indexes.
So do You see any (chaeper) solution for using 40GB DB having only 32 
(max) GB of storage I can trust? (uSD card)
> Get a real computer.  Take backups regularly.

Main DB is on "real" i7 8GB / 500 SSD.

But You are right, I am taking backups  irregular. It is not critical, 
but loosing "main" would not be nice...

W.P.

> Yours,
> Laurenz Albe







^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Is it possible to keep indexes on different disk location?
@ 2022-08-19 00:48  Ron <ronljohnsonjr@gmail.com>
  parent: W.P. <laurentp@wp.pl>
  0 siblings, 0 replies; 5+ messages in thread

From: Ron @ 2022-08-19 00:48 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 8/18/22 14:54, W.P. wrote:
[snip]
> But You are right, I am taking backups  irregular.

cron job.


-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2022-08-19 00:48 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-18 06:39 Is it possible to keep indexes on different disk location? W.P. <laurentp@wp.pl>
2022-08-18 08:58 ` hubert depesz lubaczewski <depesz@depesz.com>
2022-08-18 14:46 ` Laurenz Albe <laurenz.albe@cybertec.at>
2022-08-18 19:54   ` W.P. <laurentp@wp.pl>
2022-08-19 00:48     ` Ron <ronljohnsonjr@gmail.com>

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