Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Lucas Fairchild-Madar <lucas(dot)madar(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document
Date: 2017-10-07 01:22:52
Message-ID: 20171007012252.ao64svfi3tzslhyq@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2017-10-06 20:51:45 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > Hm. Unrelated to the topic at hand, but I wonder how much it'd take to
> > make some of the hot-path jsonb functionality tolerant of unaligned
> > datums.
>
> Probably pretty hard given the list-of-pointers data structure inside.

Hm, it'd be a bunch of memcpy's added, that's true. But even just doing
something like that to a variant of findJsonbValueFromContainer() might
be quite rewarding.

I'm kinda wondering about treating short datums differently on platforms
that don't care much about alignment, like modern x86. It'd not take
many code changes to only do alignment copying of short datums on
platforms that care...

Greetings,

Andres Freund

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2017-10-07 01:46:37 Re: BUG #14845: postgres_fdw and mysql_fdw can cause crash of instance
Previous Message Tom Lane 2017-10-07 00:51:45 Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document