From: | Lucas Fairchild-Madar <lucas(dot)madar(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | 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-06 19:11:40 |
Message-ID: | CAJmoq7MKcfk2+X8A5OeQqedg9rypGoesOOg2pJQ3SzfNBE22TA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Oct 6, 2017 at 11:48 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Lucas Fairchild-Madar <lucas(dot)madar(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-10-06 19:37:03 | Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document |
Previous Message | Tom Lane | 2017-10-06 18:48:54 | Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document |