Re: Binary search in fmgr_isbuiltin() is a bottleneck.

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Binary search in fmgr_isbuiltin() is a bottleneck.
Date: 2017-09-27 17:40:22
Message-ID: 20170927174022.27ygylbvoxglbv7f@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-09-27 13:28:22 -0400, Robert Haas wrote:
> On Wed, Sep 27, 2017 at 1:00 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> > We could relatively easily move it to be once-per-postmaster start for
> > !EXEC_BACKEND builds. Constantly doing expensive binary searches is also
> > pretty brute force ;)
>
> I think one useful way to look at it might be -
>
> How many fmgr searches does a backend need to do in order to make up
> for the time spent building the hash table?
>
> How many fmgr searches, if any, do we do during backend startup as a
> matter of course?
>
> If we're going to make up the time that it takes to build the hash
> table by the time the user runs a handful of queries, there's really
> no point in stressing about this. The use case where somebody
> repeatedly connects and disconnects without running any significant
> number of real queries is not an important one.

I don't think you can even measure the overhead of building the
table. This is inserting ~8k rows in an accurately sized hashtable - a
vanishingly small amount of time in comparison to the backend startup
time (and even more so postmaster startup). My measurement shows it
takes about 0.4 ms to build (gdb in, query, reset oid2builtins = 0,
query - repeat a couple times).

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-09-27 17:46:50 Re: Binary search in fmgr_isbuiltin() is a bottleneck.
Previous Message Antonin Houska 2017-09-27 17:38:04 Re: WIP: Separate log file for extension