Re: Do parallel queries work with only dblink not with fdw?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "Klaus P(dot)" <kpi6288(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Do parallel queries work with only dblink not with fdw?
Date: 2016-05-04 13:30:00
Message-ID: 4a12c238-0c73-4d14-0660-ad98113ba1cf@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/04/2016 01:28 AM, Klaus P. wrote:
> In order to improve cpu and disk utilization, I am testing parallel
> queries.
>
> The approach with dblink_send_query() and dblink_get_result() works in
> my proof-of-concept. Runtime of my reference query was reduced from 55
> seconds to ~20seconds using 4 parallel connections. Not what I had hoped
> but certainly a significant improvement.
>
> My approach is fairly easy:
>
> db_link_send_query('conn1', 'statement based on partitioning field');
> db_link_send_query('conn2', 'statement based on partitioning field');
>
> ...
>
> SELECT
> dblink_get_result('conn1')
> UNION ALL
> dblink_get_result('conn2')
>
> ...
>
>
> However, using fdw foreign data wrappers, I was not able to run any
> query in parallel. I came across this presentation
> http://de.slideshare.net/EnterpriseDB/foreign-data-wrappers-and-you-with-postgres
> where it says on page 12 "parallel FDW access". Is there any example
> available on how to run FDW queries in parallel?
>
> My approach with FDW is similar to the dblink example above:
>
> SELECT * FROM myFdwTable WHERE (clause based on partitioning field)
> UNION ALL
> SELECT * FROM myFdwTable WHERE (clause based on partitioning field)
> ...
>
> My experience is however that the statements are carried out sequentially.

I am not sure of the status of parallel query in FDW, but for those that
are some more information would be helpful:

1) You are using postgres_fdw, correct?

2) What version of the FDW are you using?

3) What version(s) of Postgres are you connecting from/to?

>
> Thanks
>
> Klaus Pieper

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2016-05-04 13:44:22 Re: Thoughts on "Love Your Database"
Previous Message John McKown 2016-05-04 13:25:16 Re: Thoughts on "Love Your Database"