Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> writes:
> Tom Lane wrote:
>> Is the value you are fetching from the geography table large enough to
>> be toasted? I'm thinking you might be looking at the cost of repeated
>> de-toastings.
> Yeah, it's a fairly large geometry field so it will definitely be
> getting toasted. So is it a case of with the mcatest function in place,
> we're effectively caching the de-TOASTED value?
Well, yeah, because the first thing it does is pg_detoast_datum.
Just as a cross-check, try changing it to copy the value without
forcibly detoasting --- I'll bet it's still slow then.
regards, tom lane