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 1jGpKU-0006iH-BX for pgsql-general@arkaria.postgresql.org; Tue, 24 Mar 2020 19:35:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGpKS-0002je-Nz for pgsql-general@arkaria.postgresql.org; Tue, 24 Mar 2020 19:35:12 +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 1jGpKS-0002jX-93 for pgsql-general@lists.postgresql.org; Tue, 24 Mar 2020 19:35:12 +0000 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jGpKQ-0007Cg-5S for pgsql-general@lists.postgresql.org; Tue, 24 Mar 2020 19:35:11 +0000 Received: by mail-io1-xd2b.google.com with SMTP id e20so18995062ios.12 for ; Tue, 24 Mar 2020 12:35:10 -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=yvucflnp1JqdKH5m4WfbCOYl0NgYDzyYcRhv/1iobkY=; b=nHMLbtXhy9QzPsJOyEf5HBD0MYo+J9oqyRs92rpqHmqPwti3in66IZE7ZTUPfcgM7t hm/rRdGNGmVWd5yM/cfXljrPYlPNA/t11vFhzqv3YaPDB60tOyqA6tGPHyeXJMJ2wjLS Om+GW5Z5orKcBsynRkC2aymZBzeH/X4Fn2PcIhWVnRS4KjAHfYCcrJNii+C78CskHmB2 IWimOTAPWkrxEGj7L1tBhxhCsiEmSj/sBn9yaTX3y9nEOQATJ8A+KE5eJphOmOEb9glw fve9weIqdZoLulwUyh/fzZY2z+iEw68jxwyBF97FIxcqHWeegV5kfIjHvdIw7OyfeFBM Gkaw== 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=yvucflnp1JqdKH5m4WfbCOYl0NgYDzyYcRhv/1iobkY=; b=IM4PMlYi8HFPvh/OrM/eQFjDkogPqwkQPiKE8aVZoQlCjeoMIv8wyXCDTG3O32981n FUgaEl7eqTQu2mPMvmnHudILj+cm5018McZ9dI4aDWnFvb3jOGZ9Lij6+3naKzNFKWTg AwEm1oUixO3trF6xAQYIMv8ZJWOZ24UGKLxqnblFx2194WLwtV4VS7rfvd4kM7L8aPe9 JUpWo3r3EV9RZEKvDX9SMNS9ZH5541lHIQUADGVRKaO24Ic6s7crpyeepUfFVwQkbRJm YPmZZPnH/xY1pOC+n/UhCrCbms0OCjZ9Wzk1gKy8wB6YEntCopfWHkS10t4I6fPO4xZN LvSA== X-Gm-Message-State: ANhLgQ0gE4xfJTMxHHID01wK49K0876ffIJZv/URsc8la3928/sPw1Xt g8iDkrbXMvsDOc8aCLT3s1JX3chkiPw= X-Google-Smtp-Source: ADFU+vsdsoFS9CwM/4EvaOusCDB7baopUEHP4jR979j8WacrE+3Gyh31aFakF2zHEzWjPKRVD7sXuw== X-Received: by 2002:a05:6638:a30:: with SMTP id 16mr17263588jao.4.1585078508767; Tue, 24 Mar 2020 12:35:08 -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 a1sm6618746ilr.40.2020.03.24.12.35.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Mar 2020 12:35:08 -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> <3f30c24a-d5b0-8b20-b626-5a674bb9b2f1@gmail.com> From: Rob Sargent Message-ID: <812bd681-7444-9f1e-aab8-768230bb6147@gmail.com> Date: Tue, 24 Mar 2020 13:35:07 -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: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/24/20 11:53 AM, Kevin Brannen wrote: > From: Rob Sargent > >> Sorry if I missed it, but have we seen the size range of these json files? > Not that I've seen, but that's an implementation detail for whoever is doing the work. As someone else pointed out, pick the value as needed, whether that's 10, 100, 1000, or whatever. But issuing 1000 lines of "\copy file" sort of commands at a time isn't a big deal by itself. OTOH, you have a good point that 1000 could be too much work for the server to handle, especially if the "-1" flag is also used. As always: test, test, test... 😊 > My fear is this:  the community helps OP load 500M "records" in a reasonable timeframe then OP's organization complains postgres is slow once they start using it... because the transition from file system to rdbms was ill conceived.  Are the json files large documents or arbitrary content or are they small data structures of recognizable types. And so on