Re: Performance killed with FDW when using CAST.

From: Ian Barwick <ian(dot)barwick(at)2ndquadrant(dot)com>
To: Jorge Torralba <jorge(dot)torralba(at)gmail(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Performance killed with FDW when using CAST.
Date: 2019-04-17 01:56:33
Message-ID: 3e9c9857-f95e-a5b4-151a-6634a589a9e7@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-admin

On 4/17/19 9:21 AM, Jorge Torralba wrote:
> We setup a FDW server for a large table that has an hstore data type as on eof the coums.
>
> When we run the query directly on the FDW server
>
> select * from recent_events where account_id = 1 AND (attributes -> 'account_incident_id')::integer = 2617116 limit 10;
>
> The response is 2ms . which is awesome.
>
> When we run it from the remote server where we have the server defined, the query never returns.
>
> Our server definition is as follows.
>
> (host 'fdwserver', dbname 'mydb', port '5432', fetch_size '1000', use_remote_estimate 'true', extensions 'hstore')
>
> We have been playing with this for hours to no avail.
>
> Any clues ?

At a guess the FDW is not able to push down the entire query to the FDW server
and might be doing something like fetching all the remote rows and casting
them locally, or something along those lines.

It would help to provide the following info:

- PostgreSQL versions of both servers
- "EXPLAIN" output of the query on both servers
- "EXPLAIN ANALYZE" output of the query executed directly on the FDW server
- approximate number of rows in the "recent_events" table

Regards

Ian Barwick

--
Ian Barwick https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Jorge Torralba 2019-04-17 02:40:25 Re: Performance killed with FDW when using CAST.
Previous Message Jorge Torralba 2019-04-17 00:21:24 Performance killed with FDW when using CAST.

Browse pgsql-admin by date

  From Date Subject
Next Message Ian Barwick 2019-04-17 02:11:40 Re: pgAdmin Saved Password Security
Previous Message Jorge Torralba 2019-04-17 00:21:24 Performance killed with FDW when using CAST.