Re: Query hangs (and then timeout) after using COPY to import data

2024-02-12 Thread Adrian Klaver
On 2/12/24 08:42, Adrian Klaver wrote: On 2/11/24 15:13, ste...@gmail.com wrote: Thanks, Adrian, for the suggestion, but same problem. I've just tried to execute "ANALYZE" (on the whole database) after the import of all the tables (with COPY) and before the other queries, but the query

Re: Query hangs (and then timeout) after using COPY to import data

2024-02-12 Thread Adrian Klaver
On 2/11/24 15:13, ste...@gmail.com wrote: Thanks, Adrian, for the suggestion, but same problem. I've just tried to execute "ANALYZE" (on the whole database) after the import of all the tables (with COPY) and before the other queries, but the query always hangs (I hope this was the way you

Re: Query hangs (and then timeout) after using COPY to import data

2024-02-11 Thread Tom Lane
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

Re: Query hangs (and then timeout) after using COPY to import data

2024-02-11 Thread Ron Johnson
e- > > From: Adrian Klaver > > Sent: Sunday, February 11, 2024 10:42 PM > > To: ste...@gmail.com; pgsql-general@lists.postgresql.org > > Subject: Re: Query hangs (and then timeout) after using COPY to import > data > > > > On 2/11/24 13:37, ste...@gmail.c

RE: Query hangs (and then timeout) after using COPY to import data

2024-02-11 Thread steott
ginal Message- > From: Adrian Klaver > Sent: Sunday, February 11, 2024 10:42 PM > To: ste...@gmail.com; pgsql-general@lists.postgresql.org > Subject: Re: Query hangs (and then timeout) after using COPY to import data > > On 2/11/24 13:37, ste...@gmail.com wrote: > > Hell

Re: Query hangs (and then timeout) after using COPY to import data

2024-02-11 Thread Ron Johnson
On Sun, Feb 11, 2024 at 4:41 PM Adrian Klaver wrote: > On 2/11/24 13:37, ste...@gmail.com wrote: > [snip] > > > > The same query, executed from pgAdmin, returns the result in less than a > > second (even if it’s executed while the query from my app is running). > > > > (actually the result are

Re: Query hangs (and then timeout) after using COPY to import data

2024-02-11 Thread Adrian Klaver
On 2/11/24 13:37, ste...@gmail.com wrote: Hello, I’m new to PostgreSQL. I’m trying to migrate an app from SqlServer to Postgres (it’s written in C# and uses Npgsql) I’ve tried with Postgres 16.1 and 16.2 on Windows Server 2019. This app used SqlServer’s Bulk Insert to import some tables

Query hangs (and then timeout) after using COPY to import data

2024-02-11 Thread steott
Hello, I'm new to PostgreSQL. I'm trying to migrate an app from SqlServer to Postgres (it's written in C# and uses Npgsql) I've tried with Postgres 16.1 and 16.2 on Windows Server 2019. This app used SqlServer's Bulk Insert to import some tables (about 50 tables) from another database, I