Andres Freund <andres@2ndquadrant.com> writes:
> I wrote the attached patch that get rids of that essentially quadratic
> behaviour, by replacing the mdfd chain/singly linked list with an
> array. Since we seldomly grow files by a whole segment I can't see the
> slightly bigger memory reallocations matter significantly. In pretty
> much every other case the array is bound to be a winner.
> Does anybody have fundamental arguments against that idea?
While the basic idea is sound, this particular implementation seems
pretty bizarre. What's with the "md_seg_no" stuff, and why is that
array typed size_t? IOW, why didn't you *just* replace the linked
list with an array? This patch seems to be making some other changes
that you've failed to explain.
regards, tom lane