JDBC_FDW performance issues
gferrette opened this issue · comments
Hello!
We are using jdbc_fdw to connect do DB2, and we noticed that all queries are very slow compared with the db2 client installed at the same machine.
We are firing a query like "select count(*) from table" and with jdbc_fdw it's taking 2 seconds more than db2 client.
Is there any parameter of jdbc_fdw to speed up the queries?
Thanks!
This extension does not support aggregate push-down, therefore Postgres fetches all the rows from the remote server and then counts them locally.
Currently, the only thing you can do to make things faster is to create a foreign table with query option.
CREATE FOREIGN TABLE table_count(result integer)
SERVER db2
OPTIONS(query 'select count(*) FROM table');
Patches are welcome