pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Store PDF files in PostgreDB
3+ messages / 3 participants
[nested] [flat]

* Store PDF files in PostgreDB
@ 2023-12-06 11:27 Priyadharshini Vellaisamy <priya.cs.pa@gmail.com>
  2023-12-06 14:43 ` Re: Store PDF files in PostgreDB Ron Johnson <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Priyadharshini Vellaisamy @ 2023-12-06 11:27 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hi Team,

Please let m know can we store PDF files in PostgreDB ?

If so, can we retrieve it effectively?

Thanks,
Priya

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

* Re: Store PDF files in PostgreDB
  2023-12-06 11:27 Store PDF files in PostgreDB Priyadharshini Vellaisamy <priya.cs.pa@gmail.com>
@ 2023-12-06 14:43 ` Ron Johnson <ronljohnsonjr@gmail.com>
  2023-12-08 22:31   ` Re: Store PDF files in PostgreDB Peter J. Holzer <hjp-pgsql@hjp.at>
  0 siblings, 1 reply; 3+ messages in thread

From: Ron Johnson @ 2023-12-06 14:43 UTC (permalink / raw)
  To: Priyadharshini Vellaisamy <priya.cs.pa@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

On Wed, Dec 6, 2023 at 9:39 AM Priyadharshini Vellaisamy <
priya.cs.pa@gmail.com> wrote:

> Hi Team,
>
> Please let m know can we store PDF files in PostgreDB ?
>

You can store *anything* up to 1GB in Postgresql using data type bytea.


> If so, can we retrieve it effectively?
>

Effectively?

(We've been storing images in PG for 11 years.)

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

* Re: Store PDF files in PostgreDB
  2023-12-06 11:27 Store PDF files in PostgreDB Priyadharshini Vellaisamy <priya.cs.pa@gmail.com>
  2023-12-06 14:43 ` Re: Store PDF files in PostgreDB Ron Johnson <ronljohnsonjr@gmail.com>
@ 2023-12-08 22:31   ` Peter J. Holzer <hjp-pgsql@hjp.at>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter J. Holzer @ 2023-12-08 22:31 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 2023-12-06 09:43:27 -0500, Ron Johnson wrote:
> On Wed, Dec 6, 2023 at 9:39 AM Priyadharshini Vellaisamy <priya.cs.pa@gmail.com
> > wrote:
>     Please let m know can we store PDF files in PostgreDB ?
> 
> 
> You can store anything up to 1GB in Postgresql using data type bytea.
>  
> 
>     If so, can we retrieve it effectively?
> 
> 
> Effectively?
> 
> (We've been storing images in PG for 11 years.)

They probably meant "efficiently".

The way large data is stored in PostgreSQL adds quite a bit of overhead
compared to a plain file in a file system. Plus you also have to deal
with the socket connection (unix or TCP) to the database.

That said, on my laptop (which is several years old and not very fast,
and I'm using Python, which isn't ideal for that job either) I can get
PDFs at somewhere between 47 MB/s and 77 MB/s. Which may or may not be
fast enough.

Another measure of "efficiency" might be how easy it is to use. Here,
bytea fields are very nice: They act just like varchar fields, no
special functions necessary.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachments:

  signature.asc (application/pgp-signature, 832B) download

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


end of thread, other threads:[~2023-12-08 22:31 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-12-06 11:27 Store PDF files in PostgreDB Priyadharshini Vellaisamy <priya.cs.pa@gmail.com>
2023-12-06 14:43 ` Ron Johnson <ronljohnsonjr@gmail.com>
2023-12-08 22:31   ` Peter J. Holzer <hjp-pgsql@hjp.at>

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