strk <strk(at)keybit(dot)net> writes:
> I've provided a default btree operator class but I'm often
> going out of memory when using DISTINCT or UNION clauses.
> How can I reduce memory usage in these cases ?
> Since passed argument are TOASTED, but I use only a small
> initial portion if them to make the computation, can I
> avoid DETOASTING them and still reach that initial part ?
No, I don't think so, but see PG_FREE_IF_COPY. Operators used
in btree indexes are expected not to leak memory.
regards, tom lane