>
>
> Could there be some tuning option in PostgreSQL to make queries via
> foreign tables faster (e.g. I heard about option fetch_size)?
>
fetch_size can make a difference, but it won't change a query that takes
hours into a query that takes seconds. The default is likely too low,
though.
Have you analyzed the foreign table or set use_remote_estimate? With no
statistics, postgres may just be pulling the entire remote table.
As others have mentioned, it would be useful to see your query. There may
be obvious issues, such as functions in the predicate, but without the
query, we can only guess.
>