Re: Performance killed with FDW when using CAST. - Mailing list pgsql-admin

From Ian Barwick
Subject Re: Performance killed with FDW when using CAST.
Date
Msg-id 3e9c9857-f95e-a5b4-151a-6634a589a9e7@2ndquadrant.com
Whole thread Raw
In response to Performance killed with FDW when using CAST.  (Jorge Torralba <jorge.torralba@gmail.com>)
Responses Re: Performance killed with FDW when using CAST.
List 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



pgsql-admin by date:

Previous
From: Jorge Torralba
Date:
Subject: Performance killed with FDW when using CAST.
Next
From: Ian Barwick
Date:
Subject: Re: pgAdmin Saved Password Security