Re: _mdfd_getseg can be expensive

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: _mdfd_getseg can be expensive
Date: 2014-10-31 22:48:45
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)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

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-10-31 22:58:51 Re: _mdfd_getseg can be expensive
Previous Message Michael Paquier 2014-10-31 22:46:41 Re: tracking commit timestamps