Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jGnSK-00026B-G7 for pgsql-general@arkaria.postgresql.org; Tue, 24 Mar 2020 17:35:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGnSI-00021s-Cj for pgsql-general@arkaria.postgresql.org; Tue, 24 Mar 2020 17:35:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jGnSH-00021k-Sy for pgsql-general@lists.postgresql.org; Tue, 24 Mar 2020 17:35:10 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jGnSF-00066f-N7 for pgsql-general@lists.postgresql.org; Tue, 24 Mar 2020 17:35:08 +0000 Received: by mail-io1-xd34.google.com with SMTP id k9so8284940iov.7 for ; Tue, 24 Mar 2020 10:35:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=1YZJ94+BMYp6Nie+fyos94pWmRoeEPnZrYXMBmsdPuI=; b=PuHSltd6X2FmmadPoWn018ZBjiftc4Z2GkUunjGA+YkM7XEsEezAk2W9bgjc7+afq/ VMo7G8QlJD3u5/ubqgPnjak1VvKLtyPPN0947lMWhGdCVq3fXrHDiZ0SlfF0QTHq9mAp ime7DScMt7WYlNJ6Dy16cHfyvc8iMfQIW/32VfkfyGJk6DigK7UV8NKghCfjlgN3b45p gP3JTOhmSMGalwg+6QqNUvhAu7kCoREwZLVOKy08KTS4+4Wnjrrlsit5PCaCP4DgFfgS YtELydOJjbCZbjfJNp3CC8jexil13gDTV8FzH0BHbj8Y3V/ZCkc3ml/AoWIv6vaClZ5n z/0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=1YZJ94+BMYp6Nie+fyos94pWmRoeEPnZrYXMBmsdPuI=; b=DnPM12sWmhPeijguqdlN/B/3iXpKBtN6DsfO2+R4L6CtAWSp+dpPnO+GbXl/8B2Ha9 QkmTArRzPeIvwq0K88A9JJ8HVH+uHtBtLtySl2JZJQyep8Yw2KMeOcjYdSbI6CNbXrCr COWk5zLWf3nDZ3uomsYKDNBtODoFkyuPZq0kQ7srmV4nonmUUvTxaR0Mra1luUqisFGr Kw5m9LY/+6oJs+DppR2gi5VGlc9fHrFVIfrOILFoZNFHBHXfucxQw/e1RuKkSS0mt2uH A8v+aNQ9BVYMUbfEhds75SSIX+DkYMRRHrgu0wyNiv4Q/zb+cqYD6iCC8mP4spWzJBkX 5qtg== X-Gm-Message-State: ANhLgQ3Qh1nPFC1kPO3eo8cOp5X5xFPvkg90AoESQ3GwJt3GCuCqG0rs AeIo838+FgpqZdM6+aFzxbe5eBnqEik= X-Google-Smtp-Source: ADFU+vvg1Bj6NpDkoY64xSTIJFkoyFkzyBcgD3OpuVV9fxNHEKEws2jyr+cC4281e4zbRFvBJLNCFA== X-Received: by 2002:a5d:9c15:: with SMTP id 21mr7157308ioe.47.1585071306562; Tue, 24 Mar 2020 10:35:06 -0700 (PDT) Received: from [172.16.12.101] (c-73-63-59-118.hsd1.ut.comcast.net. [73.63.59.118]) by smtp.gmail.com with ESMTPSA id n5sm5337369iop.23.2020.03.24.10.35.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Mar 2020 10:35:05 -0700 (PDT) Subject: Re: Loading 500m json files to database To: pgsql-general@lists.postgresql.org References: <1584959088557-0.post@n3.nabble.com> <7B61A925-5F3D-421C-949B-77B1EE026168@1nar.com.tr> <1468923B-049B-4EE6-A2BD-79650CC04149@n26.com> <1585009394522-0.post@n3.nabble.com> From: Rob Sargent Message-ID: <3f30c24a-d5b0-8b20-b626-5a674bb9b2f1@gmail.com> Date: Tue, 24 Mar 2020 11:32:55 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/24/20 11:29 AM, Kevin Brannen wrote: > From: pinker > >> it's a cloud and no plpythonu extension avaiable unfortunately > > You're misunderstanding him. See David's post for an example, but the point was that you can control all of this from an *external* Perl, Python, Bash, whatever program on the command line at the shell. > > In pseudo-code, probably fed by a "find" command piping filenames to it: > > while more files > do { read in a file name & add to list } while (list.length < 1000); > process entire list with \copy commands to 1 psql command > > I've left all kinds of checks out of that, but that's the basic thing that you need, implement in whatever scripting language you're comfortable with. > > HTH, > Kevin Sorry if I missed it, but have we seen the size range of these json files? > This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain confidential information. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, distribution, review, copy or use of any of the information contained in or attached to this message is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify us by reply e-mail, and destroy the original transmission and its attachments without reading them or saving them to disk. Thank you. > >