Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sz9Gn-004SsU-PL for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Oct 2024 06:37:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sz9Gk-00FFRc-Sq for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Oct 2024 06:36:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sz9Gk-00FFO2-7c for pgsql-hackers@lists.postgresql.org; Fri, 11 Oct 2024 06:36:58 +0000 Received: from mail-japanwestazon11021089.outbound.protection.outlook.com ([40.107.74.89] helo=OS0P286CU010.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sz9Gd-000K9y-J7 for pgsql-hackers@postgresql.org; Fri, 11 Oct 2024 06:36:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BPfeArq17Ey9dsCA3ARQNxT9A6eGP0n2Ki9oVq+Mw36OoPdXw3sq1sTALwtcM/l63zMi0RMX+MazPpR3niigsREkMXXEpgboC1MkL2d1C8GHnZghDEc1Lg4CkpjXhMMWvKFEUI9k+S/PGokxlwgBHhgdLb80uVWE1CnCmAjpOl6W1NGvnp29I19JKG2WG+iCs7qAh3pXUoJbdmSdVhivJnPnc0TIsxz4maqDPjbPlH6xbosQcZLuxLWQ8fVuaxusc0D6kRleOpG+/htrXYpkSsc05paaa1r88oSj81GurRpq3QOOi03YmkD7/GyZrEKr0BlbSzUdJQ43yT7FoJ0Apw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4R3Inrhj8ZwLNromIsUksAfGRWvTMyRElqSvZAv/VgE=; b=b/RimaHRYax6cI6NUGijA0cjeRr3/AXVu6rC/9Rx2p/Rc7YhoEPKl4JkKOOHf6xubK2Gpf021nae2B0S/OqLn4638J3RhlhTBaodX+H732AVJ2ekCrX4xpshxnF6RgBS10jZSNEd6s4M0bdZXc653Z0pxT3RHNImTm5d1iFGP2g3fmkVfbrduIPvW0yS1WIrvuXQyCMA0iVGINBby3KZkNs/c1HQPhnEJC+y0XxFyk9roY87uDhRLusx+t+A0Fdsu1QWK9hSZwIO4dbmaKG9rdioL1kz4Pfhha4C6t/Vb8aMan+dXFKEWIAK3CAGDNf8oaTUbFvhlUvUSSk7pdgGTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sraoss.co.jp; dmarc=pass action=none header.from=sraoss.co.jp; dkim=pass header.d=sraoss.co.jp; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sraoss.co.jp; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4R3Inrhj8ZwLNromIsUksAfGRWvTMyRElqSvZAv/VgE=; b=ANajS2WEKobT5k0e9W0aHaLMHV/3EyYxy0rytsoDT2ILIu0GERg4ct1gJ72N+SkH9qG5uYB0Mc4G3hxOq0HUgXTmS5S3oeMzLw885Pc+tkUXpUUmE+KOYljBEcKDesk3HfLozgK64F/8boQprUKursdxQRLhFiIgrkdhHGGw+Tc+8XstpnyND7+cd+5uC/aNzWHMfwOI6oXMfsIU4Y4kiovTkyu3vxYlIom2v0HX9BOktmbIm7J7Pb/qYcYk0fwH2XsdxKareDsNlQY7oxAaOb+yZK0BnLvTLsYuE1q8dYWckQzjA94D8XCJZwFwhtNBkOYNbcwq5DwGBrmvjzchEw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=sraoss.co.jp; Received: from TYBP286MB0111.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8026::10) by TY3P286MB3669.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3d4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Fri, 11 Oct 2024 06:36:46 +0000 Received: from TYBP286MB0111.JPNP286.PROD.OUTLOOK.COM ([fe80::42e3:e942:b68d:dfac]) by TYBP286MB0111.JPNP286.PROD.OUTLOOK.COM ([fe80::42e3:e942:b68d:dfac%3]) with mapi id 15.20.8048.013; Fri, 11 Oct 2024 06:36:46 +0000 Date: Fri, 11 Oct 2024 15:36:45 +0900 From: Yugo Nagata To: Fujii Masao Cc: Masahiko Sawada , Pgsql Hackers Subject: Re: Enhance file_fdw to report processed and skipped tuples in COPY progress Message-Id: <20241011153645.a348de1576a3f57092c68355@sraoss.co.jp> In-Reply-To: <47780072-032c-4c33-a8cf-384d50545b8a@oss.nttdata.com> References: <2ffa9bfa-41f6-4180-a32a-2c693ec1eeed@oss.nttdata.com> <47780072-032c-4c33-a8cf-384d50545b8a@oss.nttdata.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: TY2PR04CA0002.apcprd04.prod.outlook.com (2603:1096:404:f6::14) To TYBP286MB0111.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8026::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYBP286MB0111:EE_|TY3P286MB3669:EE_ X-MS-Office365-Filtering-Correlation-Id: bdb4e75d-7f26-4970-a232-08dce9bf13dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|10070799003|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?B?cWRnYXFWSWJaQ3k4Ukk3MEpMYVR2VFc2MWVDWm9JcjFOSHdBL2t1T1I2UndS?= =?utf-8?B?N0hzYTRabERkSzhSd3JubDN4b0tKbWcwV2FEQ0xmUnhqODVrd3pqcERmVEpm?= =?utf-8?B?L1k5dFlsMWk4TU5vU2tnRkdKMFhMS2lkdXY5b2tvc0tsZUtKNTZMVm9IMDBW?= =?utf-8?B?dVlNVlhCRmpQcnA0YVNRRHh2bnBKcGU5ZE5sQXFLSjIyWjdnVTNQRHN5RXNz?= =?utf-8?B?Y3c5QjB3RktzamJQaFh4dDBNeDJkVVV5RGhDQmxGTkF4UU9XcWk1bEhiNCtE?= =?utf-8?B?Zi9rRFZ0UWtiSU5VMThNZngrQWRoWmpXZTJYM0tSNDhYSXQ2SDZ0UnErSzVu?= =?utf-8?B?MXVRNmgxclh0WXpxWENTMGErZzNyTURCaHVoSUo4cXZROWFrcHp2SjN0QkRZ?= =?utf-8?B?cjNKTjNkV1JnQWpyWi9qdjN2c1VUamh4WHlhcVRUWDZwSlA0VDc0YjdWOEU5?= =?utf-8?B?ZHYvWkxtUEFMc0pSUzMwbFZTc2pNbGFDRHhRaDhoM0F0cVRTOERpMDBVUHFm?= =?utf-8?B?MXBtRzNUb1RJUmU3bXMzMGtyUnB4R1c5eFJrMkZRbnhsVm0xd2Fhcnorblht?= =?utf-8?B?WWczeFBBTkEzSGpSdWlRK0sxQ0c3MThpaDZYcnBxc1VOWnA3TTVQbTV6bzlF?= =?utf-8?B?R1ByNnUxVGt3cnJYMWJqUWpoei9lL0hadEJmWHpUSDZCM3J4VnEyWnBSTUFh?= =?utf-8?B?eXJlZ3p1L0grb3FoT3JacitDOG0xM2FmMFhNSDRPNmJUcmt0cnJy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TmwvMzYyS09LNXJuQVUzd0gy?= =?utf-8?B?MUh1Nit6TFR4dmh4NDQ5ZUV6NnpMVmdrVDQ5NGROeWJaMWNEeTRjbmJBPT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYBP286MB0111.JPNP286.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(10070799003)(366016)(376014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MGpULzJoa1ROSTJkYlBCbmpwdzJZSXBxaFhOeVU5ZWpZb0VhYmZUeUZrQ0Jy?= =?utf-8?B?Zm1FSENrR1ZaU3I0VmdRdVBVRVRCc2VseFhmQkRGY0tucUVEd1oyVEhxNHFB?= =?utf-8?B?MXJ1UkhKUGhodDZralVXeEhhR3RkU2xJL1AyYmNocVcySXYrSzM4dUMzMFFY?= =?utf-8?B?dmhpblNibVFUY1YvK0dBbUdCZit2d3hhb0oyMnJ1YTI3ZW5GcDk0ZUNhNTJt?= =?utf-8?B?WHdENFFFNVIzWGlTMUtqSVN2d1czRXlybUpxamdaY1hxRjFNbmNKQkdCU1hH?= =?utf-8?B?VXlDeFF1cVhSV29CQkY1cEZDSXFYdmxHSDZsenlyR3dNZXBGajdUR0t0UjNG?= =?utf-8?B?VFk0M0piRDBHdkxNczJPNG9SS0MrdWJRWHZhY1A0SDhrUGJ5THYyRTBUM0l0?= =?utf-8?B?WFJCeWp5QlZERnpVeVNvUERKcGJ3RlBvWjRYYS9ncHorTzNrcHp6UjIzbmpB?= =?utf-8?B?Tjh1dENlb2hlRmN1aFcyeHF6S1JtZG9NUXlqWks4WVNMa29meE4yMW14c1ln?= =?utf-8?B?VHRLeFB3VVY3WUpJNXgvQVFqNW5yNzBlNTV2MEdGSHFwcVlYZzJTRUM2WFFm?= =?utf-8?B?eFM4aG1jMnNu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dN?= =?utf-8?B?RHNZM0NGUFFwcTBxaE9UNVVxYjFmOGVjK2t1bDNYanZFM1NXSDZhblAyYUJN?= =?utf-8?B?ck4zZzFxTXdVN0s5MEp6b0F4UUdDdHM0TkFBUmJ0ZjdHRGxHL3BoQzFkaldn?= =?utf-8?B?eUFiWVRRdTA2QVhKSUJTTWpnbjFvVEN1OWMya1Nrd3c4SXJkZHFuZ2JoeVk2?= =?utf-8?B?Wk9xNlZIVHJKakplUkw0bmVSd1dDc0NmVVlNT0JvMk5BZEYwMHdQeVAzT3pK?= =?utf-8?B?R0xycjhPK1JGL2NKUkNNMVBaUUlGejREdUxPMTNKeHF0V3pHdEl3WEJqZ2x1?= =?utf-8?B?aDFRcXMwK0VEd0N0UGRkZEtqVjZYU1NJWmZoVVFWcjFWNTlxMlllSTVXdXdQ?= =?utf-8?B?WDI3NlgzUXdGZGJKajJNQ2s0RXpWSE0vcWRkRlZwajZ5QnpENklmeGw1N2R6?= =?utf-8?B?VTU1V2dYKzJKS2xUaStOOHJ4V1JFYlJONFozUzJ2SGR0ZG5zaUNwM05qb25W?= =?utf-8?B?MWZKUE4wdjhZV21PWWhLbm9lOFBIN2VnSWgzKzEzV0I3aG5LenczMXZRWUhS?= =?utf-8?B?SWpzRWRVOVZ1UFp4S1JmNmNTc1JaWFl6OTRMZW9xRHg4WXNBVzZiNFNzd29R?= =?utf-8?B?R09pUlF3dGtTY1hTUUVBaW1MenJBRGpTSDhhSEdhTjg4ZUlmR1AxaXRzRTM3?= =?utf-8?Q?rio0OwHJb8XIvwvcQcrUJ5kI9+AsRoFyZpQk78wvR47k?= X-OriginatorOrg: sraoss.co.jp X-MS-Exchange-CrossTenant-Network-Message-Id: bdb4e75d-7f26-4970-a232-08dce9bf13dd X-MS-Exchange-CrossTenant-AuthSource: TYBP286MB0111.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 06:36:46.2539 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 75db6c32-352e-4063-ae79-cafb8623f6db X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BbBRn9DPRmKQCfw0MK/JsM2W9mkVaHMDJslv1F7szhuOhEEyMp4LGQ40PtmmNc6oATLVEfTxrRa4svoqbWYmqA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY3P286MB3669 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 11 Oct 2024 10:53:10 +0900 Fujii Masao wrote: > > > On 2024/10/04 2:12, Masahiko Sawada wrote: > > Hi, > > > > On Thu, Oct 3, 2024 at 2:23 AM Fujii Masao wrote: > >> > >> Hi, > >> > >> Currently, file_fdw updates several columns in the pg_stat_progress_copy view, > >> like relid and bytes_processed, but it doesn't track tuples_processed or > >> tuples_skipped. Monitoring these would be particularly useful when handling > >> large data sets via file_fdw, as it helps track the progress of scan. > >> > >> The attached patch updates file_fdw to add support for reporting > >> the number of tuples processed and skipped (due to on_error = 'ignore') > >> in the pg_stat_progress_copy view. What are your thoughts? > > > > While the patch works fine and looks good to me, in the first place, > > it seems to me that the fact that file_fdw uses the COPY progress > > itself doesn't work properly. For example, unlike COPY command, > > queries could have multiple scans on one or more flie_fdw foreign > > tables when joining tables. I found the discussion for that[1]: there > > was a proposal of disabling COPY progress for file_fdw but the votes > > are split. I think it would be better to consider if we really want to > > support COPY progress for file_fdw before supporting more progress > > information. > > Yes, you're right. We need to address how to handle multiple commands > that trigger progress reporting when executed concurrently, at first. > > The current progress reporting mechanism assumes only one command > triggering progress is running at a time, as each backend has just > one memory area for progress reporting. If multiple commands run simultaneously, > the progress data would be incorrect. As you mentioned, this could happen > when querying multiple file_fdw foreign tables, where multiple COPY commands > could execute concurrently. > > However, this issue already exists without the proposed patch. > Since file_fdw already reports progress partially, querying multiple > file_fdw tables can lead to inaccurate or confusing progress reports. > You can even observe this when analyzing a file_fdw table and also > when copying to the table with a trigger that executes progress-reporting > commands. > > So, I don’t think this issue should block the proposed patch. > In fact, progress reporting is already flawed in these scenarios, > regardless of whether the patch is applied. > > On the other hand, in many cases where a single file_fdw table is scanned, > COPY progress reporting works correctly for file_fdw and is useful. > Therefore, I believe it's still worth improving file_fdw’s progress reporting. I think reporting tuples_processed and tuples_skipped columns additionally in file_fdw is reasonable, since it already reports bytes_processed and bytes_total. By the way, in the documentation of fild_fdw, it is not explicitly described that file_fdw uses COPY internally, although I can find several wordings like "as COPY". To prevent users to face unexpected experiences, how about explaining explicitly that file_fdw uses COPY and updates pg_stat_progress_copy? > To prevent misleading reports when multiple commands are run concurrently, > just idea, we could consider displaying NULL columns in the progress report > if this situation is detected, as a separate patch. Or, could we add additional field to pg_stat_progress_copy to show how much commands are running COPY? It is also just idea. Regards, Yugo Nagata -- Yugo Nagata