Re: _mdfd_getseg can be expensive - Mailing list pgsql-hackers

From Tom Lane
Subject Re: _mdfd_getseg can be expensive
Date
Msg-id 12336.1414795725@sss.pgh.pa.us
Whole thread Raw
In response to Re: _mdfd_getseg can be expensive  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: _mdfd_getseg can be expensive  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: tracking commit timestamps
Next
From: Andres Freund
Date:
Subject: Re: _mdfd_getseg can be expensive