pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Dominique Devienne <ddevienne@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How to store "blobs" efficiently for small and large sizes, with random access
Date: Wed, 19 Oct 2022 15:05:21 +0200
Message-ID: <20221019130521.5ckagzlnsevg4t3n@alvherre.pgsql> (raw)
In-Reply-To: <CAFCRh--KMuUHPvSb5KL6TJoJmykwQTgh3mAfP4B3KxHMULXMTw@mail.gmail.com>

On 2022-Oct-19, Dominique Devienne wrote:

> Upfront, I have to state that I'm not keen on lo, because of security
> considerations. We store blobs in many different schemas, and users
> can access some schemas, and not others. So the fact the lo table is
> unique for the whole database would allow users to see blobs from any
> schema, as I understand it. Right? OTOH, lo has random access, which I
> also need...

Generally speaking, bytea sucks for random access, because if a TOAST
item is compressed, it has to be always read from the beginning in order
to decompress correctly.  However, if you set
ALTER TABLE tab ALTER COLUMN byt SET STORAGE EXTERNAL
then compression is not used, and random access becomes fast.

https://www.postgresql.org/docs/15/sql-altertable.html

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"No hay hombre que no aspire a la plenitud, es decir,
la suma de experiencias de que un hombre es capaz"





view thread (23+ messages)  latest in thread

Message-ID: <20221019130521.5ckagzlnsevg4t3n@alvherre.pgsql>
Permalink:  ../20221019130521.5ckagzlnsevg4t3n@alvherre.pgsql/
Also on:    postgresql.org/message-id/20221019130521.5ckagzlnsevg4t3n@alvherre.pgsql

 · 

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: alvherre@alvh.no-ip.org, ddevienne@gmail.com
  Subject: Re: How to store "blobs" efficiently for small and large sizes, with random access
  In-Reply-To: <20221019130521.5ckagzlnsevg4t3n@alvherre.pgsql>
  References: <CAFCRh--KMuUHPvSb5KL6TJoJmykwQTgh3mAfP4B3KxHMULXMTw@mail.gmail.com> <20221019130521.5ckagzlnsevg4t3n@alvherre.pgsql>

* 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