Re:File Attachments: Databases can now store files and images
by hot_gril on Thursday August 31, 2023 @02:36AM
(#37333285)
The Postgres TEXT type is limited to 65,535 bytes, to give a concrete number. "Big" usually means, big enough that you have to stream rather than sending all at once.
[ Parent
| on HN ]
Re:File Attachments: Databases can now store files and images
by asjo on Thursday August 31, 2023 @03:39PM
(#37342643)
The PostgreSQL manual states:
> the longest possible character string that can be stored is about 1 GB.
ยท https://www.postgresql.org/docs/current/datatype-character.h...
See also: https://www.postgresql.org/docs/current/limits.html
Where do you have the 64KB number from?
A small test:
test=# create table test_table (test_field text);
CREATE TABLE
test=# insert into test_table select string_agg('x', '') from generate_series(1, 128*1024);
INSERT 0 1
test=# select length(test_field) from test_table;
length
--------
131072
(1 row)
Re:File Attachments: Databases can now store files and images
by hot_gril on Thursday August 31, 2023 @03:46PM
(#37342729)
You're right. Bad Google suggestion for "max string length postgres" that pointed to https://hevodata.com/learn/postgresql-varchar/ saying varchar max is 64KB, which is also wrong. I gotta stick to the official docs. Anyway, TEXT is the one we care about.
In MySQL, the TEXT (and BLOB) limit is 65KB, but you can get 4GB using LONGTEXT. According to their docs: https://dev.mysql.com/doc/refman/8.0/en/string-type-syntax.h...