pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feeddocument json[b] limitation
5+ messages / 3 participants
[nested] [flat]
* document json[b] limitation
@ 2018-04-24 16:53 Oleg Bartunov <obartunov@postgrespro.ru>
0 siblings, 1 reply; 5+ messages in thread
From: Oleg Bartunov @ 2018-04-24 16:53 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org
Hi there,
Attached is a small patch, which documents the maximum size of
json[b] types. Probably, it's worth to patch previous releases, where
the types were introduced.
Best regards,
Oleg
--
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachments:
json.sgml.patch (application/octet-stream, 442B) download
--- json.sgml.orig 2018-04-03 17:02:23.000000000 +0300
+++ json.sgml 2018-04-24 19:49:49.000000000 +0300
@@ -46,6 +46,11 @@
only the last value is kept.
</para>
+<para>
+ The longest possible <type>json</type> value is 1 Gb. For <type>jsonb</type>
+ the limit is 256 Gb.
+</para>
+
<para>
In general, most applications should prefer to store JSON data as
<type>jsonb</type>, unless there are quite specialized needs, such as
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: document json[b] limitation
@ 2018-04-24 23:12 Tom Lane <tgl@sss.pgh.pa.us>
parent: Oleg Bartunov <obartunov@postgrespro.ru>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2018-04-24 23:12 UTC (permalink / raw)
To: Oleg Bartunov <obartunov@postgrespro.ru>; +Cc: pgsql-docs@lists.postgresql.org
Oleg Bartunov <obartunov@postgrespro.ru> writes:
> Attached is a small patch, which documents the maximum size of
> json[b] types. Probably, it's worth to patch previous releases, where
> the types were introduced.
If you said "maximum size is 1GB", period, I'd believe it ... although
I'm pretty sure that general limitation is already documented elsewhere.
I don't believe that it's possible to make a 256 Gb jsonb. How will
that fit in the varlena header?
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: document json[b] limitation
@ 2018-04-25 15:50 Oleg Bartunov <obartunov@postgrespro.ru>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 5+ messages in thread
From: Oleg Bartunov @ 2018-04-25 15:50 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-docs@lists.postgresql.org
On Wed, Apr 25, 2018 at 2:12 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Oleg Bartunov <obartunov@postgrespro.ru> writes:
>> Attached is a small patch, which documents the maximum size of
>> json[b] types. Probably, it's worth to patch previous releases, where
>> the types were introduced.
>
> If you said "maximum size is 1GB", period, I'd believe it ... although
> I'm pretty sure that general limitation is already documented elsewhere.
> I don't believe that it's possible to make a 256 Gb jsonb. How will
> that fit in the varlena header?
Oops, it should be 256 Mb :)
>
> regards, tom lane
>
--
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: document json[b] limitation
@ 2018-04-25 19:42 Oleg Bartunov <obartunov@postgrespro.ru>
parent: Oleg Bartunov <obartunov@postgrespro.ru>
1 sibling, 0 replies; 5+ messages in thread
From: Oleg Bartunov @ 2018-04-25 19:42 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-docs@lists.postgresql.org
On Wed, Apr 25, 2018 at 6:50 PM, Oleg Bartunov <obartunov@postgrespro.ru> wrote:
> On Wed, Apr 25, 2018 at 2:12 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Oleg Bartunov <obartunov@postgrespro.ru> writes:
>>> Attached is a small patch, which documents the maximum size of
>>> json[b] types. Probably, it's worth to patch previous releases, where
>>> the types were introduced.
>>
>> If you said "maximum size is 1GB", period, I'd believe it ... although
>> I'm pretty sure that general limitation is already documented elsewhere.
>> I don't believe that it's possible to make a 256 Gb jsonb. How will
>> that fit in the varlena header?
>
> Oops, it should be 256 Mb :)
patch attached.
>
>>
>> regards, tom lane
>>
>
>
>
> --
> Postgres Professional: http://www.postgrespro.com
> The Russian Postgres Company
--
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachments:
json.sgml.patch (application/octet-stream, 442B) download
--- json.sgml.orig 2018-04-03 17:02:23.000000000 +0300
+++ json.sgml 2018-04-25 22:39:54.000000000 +0300
@@ -46,6 +46,11 @@
only the last value is kept.
</para>
+<para>
+ The longest possible <type>json</type> value is 1 Gb. For <type>jsonb</type>
+ the limit is 256 Mb.
+</para>
+
<para>
In general, most applications should prefer to store JSON data as
<type>jsonb</type>, unless there are quite specialized needs, such as
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: document json[b] limitation
@ 2018-04-26 01:59 Michael Paquier <michael@paquier.xyz>
parent: Oleg Bartunov <obartunov@postgrespro.ru>
1 sibling, 0 replies; 5+ messages in thread
From: Michael Paquier @ 2018-04-26 01:59 UTC (permalink / raw)
To: Oleg Bartunov <obartunov@postgrespro.ru>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-docs@lists.postgresql.org
On Wed, Apr 25, 2018 at 06:50:51PM +0300, Oleg Bartunov wrote:
> Oops, it should be 256 Mb :)
The numbers you are presenting are right, aka 1GB for json:
=# create table aa (a json);
CREATE TABLE
=# insert into aa select ('{"key":"' || repeat('a', 512 * 1024 * 1024) ||
repeat('a', 500 * 1024 * 1024) || '"}')::json;
INSERT 0 1
=# insert into aa select ('{"key":"' || repeat('a', 512 * 1024 *
1024) || repeat('a', 512 * 1024 * 1024) || '"}')::json;
ERROR: XX000: invalid memory alloc request size 1073741836
LOCATION: palloc, mcxt.c:934
And 256MB for jsonb:
=# create table ab (a jsonb);
CREATE TABLE
=# insert into aa select ('{"key":"' || repeat('a', 256 * 1024 *
1024) || '"}')::jsonb;
ERROR: 54000: string too long to represent as jsonb string
DETAIL: Due to an implementation restriction, jsonb strings cannot
exceed 268435455 bytes.
Be sure to use an upper-case "B" to mean bytes and not bits in the
documentation.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2018-04-26 01:59 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24 16:53 document json[b] limitation Oleg Bartunov <obartunov@postgrespro.ru>
2018-04-24 23:12 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-04-25 15:50 ` Oleg Bartunov <obartunov@postgrespro.ru>
2018-04-25 19:42 ` Oleg Bartunov <obartunov@postgrespro.ru>
2018-04-26 01:59 ` Michael Paquier <michael@paquier.xyz>
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