PostgreSQL optimizer use seq scan instead of pkey index only scan (in queries with postgres_fdw)

2019-05-06 Thread Vitaly Baranovsky
Hello all, I faced strange behavior of PostgreSQL during the query execution. So, I have to databases: local and foreign. There are foreign server definitions in the local database (via postgres_fdw). The local database has table 'local_table'. The foreign database has table 'foreign_table'. Both

Re: PostgreSQL optimizer use seq scan instead of pkey index only scan (in queries with postgres_fdw)

2019-05-06 Thread Vitaly Baranovsky
e seq scan instead of pk key index only scan for the local table? Thank you ᐧ On Mon, May 6, 2019 at 6:32 PM Jeff Janes wrote: > On Mon, May 6, 2019 at 10:44 AM Vitaly Baranovsky < > barvetalfor...@gmail.com> wrote: > >> Hello all, >> >> I faced strange behavi

Re: PostgreSQL optimizer use seq scan instead of pkey index only scan (in queries with postgres_fdw)

2019-05-06 Thread Vitaly Baranovsky
Ough, I believed I had use_remote_estimate = true in my database, but it was false :( With use_remote_estimate = true everything works well! Here is explain analyze with use_remote_estimate = true: "Nested Loop (cost=100.45..108.97 rows=10 width=16) (actual time=1.037..1.037 rows=0 loops=1)"

The wrong (?) query plan for queries with remote (postgres_fdw) tables

2019-05-14 Thread Vitaly Baranovsky
Hello, I have an inefficient query execution for queries with postgres_fdw. I have an ineffective query with remote tables (postgres_fdw) that works for about 1 second. The same query with local tables (with the same data) instead of foreign ones has execution time less than 5 ms. So, the differe