Re: [BUGS] json(b)_array_elements use causes very large memory usagewhen also referencing entire json document
От | Lucas Fairchild-Madar |
---|---|
Тема | Re: [BUGS] json(b)_array_elements use causes very large memory usagewhen also referencing entire json document |
Дата | |
Msg-id | CAJmoq7MKcfk2+X8A5OeQqedg9rypGoesOOg2pJQ3SzfNBE22TA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [BUGS] json(b)_array_elements use causes very large memory usage when also referencing entire json document (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: [BUGS] json(b)_array_elements use causes very large memory usage when also referencing entire json document
|
Список | pgsql-bugs |
On Fri, Oct 6, 2017 at 11:48 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Lucas Fairchild-Madar <lucas.madar@gmail.com> writes:
> I'm experiencing this on 9.6.
Oh, hmm, it's something else in that case. Can you put together a
more self-contained test case? This sort of thing isn't usually
very data-dependent, so you could probably make a test case with
dummy data.
regards, tom lane
Sure, here's a bash script. Assumes you have PGDATABASE, etc set.
Verified this also blows up on pg 10. I haven't verified the new patch.
#!/bin/bash
ITEMS=100000
FILE=kaboom.sql
echo -n "{\"id\":\"foo\",\"items\":[" > $FILE
for i in $(seq 1 $ITEMS); do
echo -n "{\"item\":$i,\"data\":\"The quick brown cow jumps over the lazy sloth\"}," >> $FILE
done
echo "{\"dummy\":true}]}" >> $FILE
psql -e -c "drop table if exists kaboom; create table kaboom(data jsonb);"
psql -e -c "\\copy kaboom from kaboom.sql"
echo "this works"
psql -qAtc "select jsonb_array_elements(data->'items') from kaboom;" | wc
echo "prepare to swap"
psql -qAtc "select data->'id', jsonb_array_elements(data->'items') from kaboom;" | wc
В списке pgsql-bugs по дате отправления: