Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q4Ti1-0000dd-Cu for pgsql-general@arkaria.postgresql.org; Wed, 31 May 2023 21:50:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q4Thx-0002I5-MU for pgsql-general@arkaria.postgresql.org; Wed, 31 May 2023 21:50:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q4Thx-0002Hv-B6 for pgsql-general@lists.postgresql.org; Wed, 31 May 2023 21:50:17 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q4Tht-003MYF-8x for pgsql-general@lists.postgresql.org; Wed, 31 May 2023 21:50:16 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id C3DE53200911; Wed, 31 May 2023 17:50:11 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 31 May 2023 17:50:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1685569811; x=1685656211; bh=TtmoHplDJgpuuY98SM0CBfMSgpQY4OaQczz JfsOGUcI=; b=fJCjqySt4H5S24qBI8J0uakYoMXVHBgPx3YkfnICYU6rIBIuNPr Hdf/ZuZv5tDGobqHe/ABuIgqwRAmK9+2Oq0+tuPFopej4xxjTexaSOhIp5vt9Y1s cZo06ESAEes33PHm4UFVYPxnAC6aY2sNQOLg9Zu7hINMgU8FXCGzdnxTCW5e96Ue 4nfe97Yt9hI/yFQ2vKFqEkqA58EXZr5o6JB/QokXjhlEaG9uLcy4gzDRlCesi+aC kBRfuGDtPLzGwQjomJ8tRW/t9nUU5S+BtiX0VpwRxS4dicDkQx0D90jCcPZivh8X D0DUPepeObi8wTazKuvNhL6Xq6vGbkuk+Tw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1685569811; x=1685656211; bh=TtmoHplDJgpuuY98SM0CBfMSgpQY4OaQczz JfsOGUcI=; b=iqhiqQLlgK6+w6WGJKabwwjuBXSuAfaXTEU3880HDBUl0w9nC4R Mkpegt/VP+owHESgxkKf/PdUVJQ38EWPuvGEwyZBP7Ry2hW2KwGP6jfadu+G+jUK I/1A7I+NLmaUw+0L8G31qZPmLDML9v8qfp069A+wKfbPIPR2DD8V5LUVqkWP/4+h Bq/faDu9amSfkVybN2Bv9X2F9F+ky1DxQusueQhHDMbm1EF69e9UqRRPzSj8Lljq 5edXCXvhYNr+U1MjGmGQt9LBhimmOoySzbZDdIG7mGeLEkZQtrY545nf0HdtV565 q7gCcMOO0AkqEvxghE3MbyqRV63wM7/PAaQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeltddgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepjeeifeefffdujefftdfgjeduhfegtdegiedtvdfh veehgfduleefteevudegheetnecuffhomhgrihhnpehsnhhofihflhgrkhgvrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 31 May 2023 17:50:10 -0400 (EDT) Message-ID: <79615d08-0bbb-066b-6092-7f59703969bb@aklaver.com> Date: Wed, 31 May 2023 14:50:10 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: speed up full table scan using psql Content-Language: en-US To: Lian Jiang Cc: pgsql-general@lists.postgresql.org References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/31/23 13:57, Lian Jiang wrote: > The command is: psql $db_url -c "copy (select row_to_json(x_tmp_uniq) > from public.mytable x_tmp_uniq) to stdout" > postgres version:  14.7 > Does this mean COPY and java CopyManager may not help since my psql > command already uses copy? > > Regarding pg_dump, it does not support json format which means extra > work is needed to convert the supported format to jsonl (or parquet) so > that they can be imported into snowflake. Still exploring but want to > call it out early. Maybe 'custom' format can be parquet? Oops I read this: '...Using spark to read the postgres table...' and missed that you are trying to load into Snowflake. It seems Snowflake supports CSV as well: https://docs.snowflake.com/en/user-guide/data-load-prepare So the previous advice should still hold. > > > Thanks > Lian -- Adrian Klaver adrian.klaver@aklaver.com