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.89) (envelope-from ) id 1gU7Fk-0004qy-It for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Dec 2018 09:44:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gU7Fj-0001gr-8U for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Dec 2018 09:44:27 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gU7Fi-0001cj-Qw for pgsql-hackers@lists.postgresql.org; Tue, 04 Dec 2018 09:44:27 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gU7Ff-00057L-FL for pgsql-hackers@lists.postgresql.org; Tue, 04 Dec 2018 09:44:26 +0000 Received: by mail-qk1-x741.google.com with SMTP id d19so9200199qkg.5 for ; Tue, 04 Dec 2018 01:44:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=2nz8E1sKWtLObOMxOnwozWKvRIO9M3vAOhOzhwyWZp8=; b=e4lnL2u3ucoONCR5lU001GnF9JXHd+D868PfqZmRb86wMrqX+KaE8Y/8ZMdZBTWQfW sAxAzsxGyrGnyLaKgGelIKQx7FS9BPMwGOfqmlINGAd0GO/jHwEHohBwv50kRn8/AnWA DZdMXmjQJNzPTGOWi7vcpBTCWJTdQgvRJC8XXCSr333/1Y1h0wHSqxIbrWqRViDm/Jnm Oe51GR3ll5PR3Z3/apKErLutF2zfPnOStZ3vHO+pfU5Umoo2+hXYkz50SHNOc5I017ev GHWr/SjJeyM9DqMXjIc3huGnU4+WihdmGpSaKB+lS3BpTiwfOXldLAtBTCv7N60D1ICJ tmsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=2nz8E1sKWtLObOMxOnwozWKvRIO9M3vAOhOzhwyWZp8=; b=gv05BbSOpMy6t6hCNOpasBqi6xIoPo6pLSwS0qQpZvO0Nl5CLBw2iFBw+qr+rWWodC 2cwNV3rlFVPgFR9nKN0bWy+j2GB4aOItWCawNkpwSS0tIO6OuhNNoK/rxeYW+jZtOta1 WKqJlcS6i2p/xI9z8dTwL8ULKkWOCqYuIrP85AwgwFzsz0QP5umUNG60tcgZ2GNYvJK4 uTc0Xx2sNUs2watlbq2OvJ6DShg05L70PfebVsb6IrSNUeM+Vf6bhdbBRV0zA2mZ9ez5 1ypuCB6TFNNoT1a0KBgm8XhYDfxDMK2VY07qjTrSeG4c7C2QSnxVEJ+bQMT0NiI19+5j Z1EA== X-Gm-Message-State: AA+aEWbdhoPJws2A5g3z2U7NLcFsYWvtZ7PbY6YMC4BIrvR6mN246XZo xXDVHRFB3vQzuDTMLTrvXp5r/Q== X-Google-Smtp-Source: AFSGD/VIYLehbNlUr87kT2PbH9Huga4d8wvBosgtFZ8x91Ka2PnQL4XvwoCJJmBlCSHJOJs/gK7NqQ== X-Received: by 2002:a37:a3c6:: with SMTP id m189mr18005592qke.173.1543916661345; Tue, 04 Dec 2018 01:44:21 -0800 (PST) Received: from alvin.alvh.no-ip.org ([201.186.80.75]) by smtp.gmail.com with ESMTPSA id u16sm12661157qkg.14.2018.12.04.01.44.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Dec 2018 01:44:20 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id E80B3580; Tue, 4 Dec 2018 06:44:18 -0300 (-03) Date: Tue, 4 Dec 2018 06:44:18 -0300 From: Alvaro Herrera To: Tomas Vondra Cc: Surafel Temesgen , Adam Berlin , pgsql-hackers@lists.postgresql.org Subject: Re: COPY FROM WHEN condition Message-ID: <20181204094418.wpr6mxrtsuxb5mlq@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <194e2225-b186-9325-0cd1-9a5b09d28251@2ndquadrant.com> User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk After reading this thread, I think I like WHERE better than FILTER. Tally: WHERE: Adam Berlin, Lim Myungkyu, Dean Rasheed, yours truly FILTER: Tomas Vondra, Surafel Temesgen Couldn't find others expressing an opinion in this regard. On 2018-Nov-30, Tomas Vondra wrote: > I think it should be enough just to switch to CIM_SINGLE and increment the > command counter after each inserted row. Do we apply command counter increment per row with some other COPY option? Per-row CCI makes me a bit uncomfortable because with you'd get in trouble with a large copy. I think it's particularly nasty here, precisely because you may want to filter out some rows of a very large file, and the CCI may prevent that from working. I'm not convinced by the example case of reading how many tuples you've imported so far in the WHERE/WHEN/FILTER clause each time (that'd become incrementally slower as it progresses). -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services