Re: Foreign table scan estimates

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Tom Lane *EXTERN*" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Foreign table scan estimates
Date: 2012-04-24 09:40:55
Message-ID: D960CB61B694CF459DCFB4B0128514C207CD2614@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
>> While playing around with ANALYZE on foreign tables, I noticed
>> that the row count estimate for foreign scans is still
>> initialized to 1000 even if there are statistics for the
>> foreign table. I think that this should be improved.

>> The attached patch illustrates my suggestion.

> I don't think this is appropriate; it will just waste cycles because
> the FDW will have to repeat the calculations after obtaining a real
> estimate of the foreign table size. If we trusted pg_class.reltuples
> to be up to date, there might be some value in this. But we don't
> trust that for regular tables (cf. plancat.c), and I don't see why
> we would do so for foreign tables.
>
> I think on the whole it's better to abdicate responsibility here and
> require the FDW to do something in its GetForeignRelSize function.
> It's not like we'd be saving the FDW a lot of code in the (unlikely)
> case that this is exactly what it would do anyway.

I agree.

Yours,
Laurenz Albe

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2012-04-24 13:00:52 Re: B-tree page deletion boundary cases
Previous Message Krzysztof Nienartowicz 2012-04-24 09:12:56 Re: [HACKERS] Namespace of array of user defined types is confused by the parser in insert?