From: | "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Store PDF files in PostgreDB |
Date: | 2023-12-08 22:31:50 |
Message-ID: | 20231208223150.4vatjjhrmnta4qck@hjp.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2023-12-06 09:43:27 -0500, Ron Johnson wrote:
> On Wed, Dec 6, 2023 at 9:39 AM Priyadharshini Vellaisamy <priya(dot)cs(dot)pa(at)gmail(dot)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(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
From | Date | Subject | |
---|---|---|---|
Next Message | peter.borissow@kartographia.com | 2023-12-08 23:44:23 | Re: Inserting into foreign table with sequences and default values |
Previous Message | Joe Conway | 2023-12-08 21:26:40 | Re: Emitting JSON to file using COPY TO |