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 1rZJUT-003U9m-EW for pgsql-general@arkaria.postgresql.org; Sun, 11 Feb 2024 23:44:05 +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 1rZJUS-005uQ7-8e for pgsql-general@arkaria.postgresql.org; Sun, 11 Feb 2024 23:44:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rZJUR-005uPy-UA for pgsql-general@lists.postgresql.org; Sun, 11 Feb 2024 23:44:03 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rZJUP-006ibk-3A for pgsql-general@lists.postgresql.org; Sun, 11 Feb 2024 23:44:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 41BNhwUq2077734; Sun, 11 Feb 2024 18:43:58 -0500 From: Tom Lane To: Ron Johnson cc: "pgsql-generallists.postgresql.org" Subject: Re: Query hangs (and then timeout) after using COPY to import data In-reply-to: References: <002401da5d32$8637c200$92a74600$@gmail.com> <98a7e782-96bc-4c55-a919-bda0d5d35f87@aklaver.com> <004301da5d3f$f3d0ef50$db72cdf0$@gmail.com> Comments: In-reply-to Ron Johnson message dated "Sun, 11 Feb 2024 18:27:04 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2077732.1707695038.1@sss.pgh.pa.us> Date: Sun, 11 Feb 2024 18:43:58 -0500 Message-ID: <2077733.1707695038@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ron Johnson writes: > Since the query works in PgAdmin, but not in npgsql, the problem has to be > somewhere in Npgsql. I'm wondering if npgsql is executing the query as a cursor and that is causing the planner to make a poor choice of plan. There is a bias towards fast-start plans if you use a cursor, and that doesn't always work well :-( regards, tom lane