Re: How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>
Cc: PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale
Date: 2014-10-03 04:25:40
Message-ID: 7838.1412310340@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com> writes:
> Idea-1) Put ResourceOwnerForgetBuffer() O(1) logic, instead of O(N^2).
> The source of problem come from data structure in ResourceOwnerData,
> so a straightforward way is to apply O(1) logic based on hashing,
> instead of the linear search.

I will bet that this is a dead loss for all normal usage patterns,
because queries seldom have more than a few buffers pinned. More
than that: I do not think we should encourage coding patterns that
pin lots of buffers. There is no way that holding pins on thousands
of buffers to do one operation is a sane design.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Claudio Freire 2014-10-03 04:40:20 Re: DDL Damage Assessment
Previous Message Kouhei Kaigai 2014-10-03 04:08:09 How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale