Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> writes:
> So by adding in an extra function around the subselect result, we have
> speeded up the index lookup by several orders of magnitude, and the
> speedup appears to be coming from somewhere within the index scan?!
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.
BTW, that mcatest function is buggy --- it's not copying the last
4 bytes of the source value. I don't know enough about PostGIS
data types to know what effect that would have.
regards, tom lane