On Mon, 2 Feb 2004, Tom Lane wrote:
> Jeff <threshar@torgo.978.org> writes:
> >> On Sat, 31 Jan 2004, Tom Lane wrote:
> > Well, maybe. What's in the back of my mind is that we may come
> > across other cases besides CREATE INDEX and VACUUM that should use a
> > "one-off" setting. I think it'd make more sense to have one
> > parameter than keep on inventing new ones.
>
> > I don't know if this would apply here - but foriegn key creation also
> > benefits hugely from jacking up sort_mem and you also don't do too many
> > of those in parellel.
>
> > I'm guessing it would be quite in-elegant and kludgy to make that code
> > use the bigger pool.. it would benefit restore times though.
>
> Actually, it wouldn't be all that hard. We could make
> RI_Initial_Check() do the equivalent of "SET LOCAL work_mem" before
> issuing the query, and then again afterwards to restore the prior
> value. This would have no permanent effect on work_mem, because the
> old value would be restored by transaction abort if the check query
> fails.
>
> This seems like a good idea to me, so I'll do it unless I hear
> objections.
any chance of having some kind of max_total_sort_mem setting to keep
machines out of swap storms, or would that be a nightmare to implement?