Re: Question about optimising (Postgres_)FDW - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Question about optimising (Postgres_)FDW
Date
Msg-id 6849.1397604332@sss.pgh.pa.us
Whole thread Raw
In response to Question about optimising (Postgres_)FDW  (Hannu Krosing <hannu@2ndQuadrant.com>)
Responses Re: Question about optimising (Postgres_)FDW  (Hannu Krosing <hannu@2ndQuadrant.com>)
List pgsql-hackers
Hannu Krosing <hannu@2ndQuadrant.com> writes:
> Is there a way to force it to prefer a plan where the results of (select
> id from onemillion where data > '0.9' limit 100)
> are passed to FDW as a single IN ( = ANY(...)) query and are retrieved
> all at once ?

You could write the query like that:

select * from onemillion_pgfdw where id = any (array(select id from
onemillion where data > '0.9' limit 100));

Or at least you should be able to, except when I try it I get

explain analyze
select * from onemillion_pgfdw where id = any (array(select id from
onemillion where data > '0.9' limit 100));
ERROR:  operator does not exist: integer = integer[]
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
CONTEXT:  Remote SQL command: EXPLAIN SELECT id, inserted, data FROM public.onemillion WHERE ((id = ANY ((SELECT
null::integer[]))))

so there's something the remote-estimate code is getting wrong here.
(It seems to work without remote_estimate, though.)
        regards, tom lane



pgsql-hackers by date:

Previous
From: Ants Aasma
Date:
Subject: Re: Clock sweep not caching enough B-Tree leaf pages?
Next
From: Peter Geoghegan
Date:
Subject: Re: Clock sweep not caching enough B-Tree leaf pages?