Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eLeG1-00072f-D9 for pgsql-general@arkaria.postgresql.org; Mon, 04 Dec 2017 00:05:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eLeG0-0006W7-TD for pgsql-general@arkaria.postgresql.org; Mon, 04 Dec 2017 00:05:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eLeCM-0002GB-If for pgsql-general@lists.postgresql.org; Mon, 04 Dec 2017 00:01:26 +0000 Received: from mail-qt0-x232.google.com ([2607:f8b0:400d:c0d::232]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eLeCJ-00031A-50 for pgsql-general@lists.postgresql.org; Mon, 04 Dec 2017 00:01:25 +0000 Received: by mail-qt0-x232.google.com with SMTP id e2so19245197qti.0 for ; Sun, 03 Dec 2017 16:01:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:date:in-reply-to:references:mime-version :content-transfer-encoding; bh=FDXxlC/Ioe5ESaqwZvh0BzOCQWbf+CbKNKhnCsV+RGk=; b=TpoWuIHQDMQmzBfiAPXDkt1eal628Jy+2EDuDqVvqElSFYtgWbCzMnlsQXfXFveZn+ G26e7hk7/H9DwCECXnBQ6yuQE1RTI/P2RBQtuSbCuVEeIdr3uivZYYLkKkiM8e6zfrhF 3L/Z6trzRdJHW1Nqj3N3dTsi6Qeofx8zqVU3Y+I+2cCkFR6RvQbEJJYgf3Lxq1g7Dsmn +frlB2KWffsR5Tnn49gSEN2j22ALTEz5ucwdLVB9/334IkALPfOYUqynb8f7/+IbLHsp g4AmMTfZpo/gY6BSDBc4u/v2etcqj3vmzWfx5AWgeGbEENOa4jDM9EGw2DDF2gMioJMR Gf/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=FDXxlC/Ioe5ESaqwZvh0BzOCQWbf+CbKNKhnCsV+RGk=; b=VNqbvHpTLZQXnhaqcgHtPvlZ7Py0E2UUTH2sQSpbANd67ROnax5/jHUfh/gvxiSqyK GSotgpr93GCqH654EnsLx3KjMuGVt0zAny4dB4PKvnZ9T570viK8mUKaBFMrV6Sv9KfB PtExipkGJqD5SK7pnb8yIEiPQXiYE1lgZFCcSVUT09JZcR6S0XMQSuNIOidhCw6eZgd8 oWsgUv2SqgkArXwXLHrmqct8tXuPubZTZDtMuMhijQRofZ7NxlBCmWEkvribL7PJq4we lbiniKHuDw7Dh18WpZwoUWwRBQkmaQ+RIrEwxKsw4z+B3+Y8syTAAChe1IvpFTRhCyXg OUEg== X-Gm-Message-State: AKGB3mKhXlCq4DRuzZ2mzkd/q+3mnOqOnGPvXnZf6YNJJgDkwZnphYuN w+17lMYHvBMVSJHrZ9wJYWU= X-Google-Smtp-Source: AGs4zMboTKZ4ey0Z/nh3erBZ3BpoMT38nM9GOs7DdUIwx0BNR7VW/ax/6P6QMr3oAIHGOd8dP1UaIA== X-Received: by 10.237.33.248 with SMTP id m53mr10197319qtc.39.1512345680733; Sun, 03 Dec 2017 16:01:20 -0800 (PST) Received: from roblaptop ([2804:14d:baa0:8491:461e:a1ff:fe19:c7bd]) by smtp.gmail.com with ESMTPSA id p74sm8494941qkl.22.2017.12.03.16.01.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Dec 2017 16:01:20 -0800 (PST) Message-ID: <1512345677.5030.1.camel@gmail.com> Subject: Re: JSON out of memory error on PostgreSQL 9.6.x From: rob stone To: Yuri Budilov , John R Pierce , "pgsql-general@lists.postgresql.org" Date: Mon, 04 Dec 2017 11:01:17 +1100 In-Reply-To: References: <81363279.2185591.1511207314550.ref@mail.yahoo.com> <81363279.2185591.1511207314550@mail.yahoo.com> <6207.1511235609@sss.pgh.pa.us> , Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, 2017-12-03 at 23:18 +0000, Yuri Budilov wrote: > Posted on Stack Overflow, sadly no replies, so trying here.... > > CREATE TABLE X AS > SELECT json_array_elements(json_rmq -> 'orders'::text) AS order > FROM table_name > WHERE blah; > I get out of memory error. > > Is there anything I can do to unpack the above? > > The JSON column is about ~5 MB and it has about ~150,000 array > row elements in 'orders' above. > > I tried work_mem values up to ~250MB and it did not help, the query > takes about same time to fail. > > I guess this parameter does not help JSON processing. > > If there another parameter I can try? Something else? > > I don't have control of the size of the JSON payload, it arrives, we > store it in a JSON column and then we need to crack it open. > > Many thanks! > Hello, It would help if you advised:- (a) version of PostgreSql being used. (b) is column json_rmq defined as json or jsonb? (c) OS. Cheers, Rob