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

tushar <tushar.ahuja@enterprisedb.com>

From: tushar <tushar.ahuja@enterprisedb.com>
To: Andres Freund <andres@anarazel.de>, pgsql-hackers@postgresql.org
Date: 2017-09-27T11:59:32Z
Lists: pgsql-hackers

Attachments

On 09/14/2017 12:21 PM, Andres Freund wrote:
> Hi,
>
> Surprising myself I discovered that in workloads that do a large number
> of fmgr_info* lookups, fmgr_isbuiltin() is actually quite the
> bottleneck.
>
After discussion with Jeevan Ladhe, we created a sql query which contain 
lots of inbuild function and tested that against pgbench    with  master 
v/s patch and found an improvement

Virtual Machine configuration - Centos 6.5 x64 / 16 GB RAM / 8 VCPU core 
processor


pgbench -c 8 -j 8 -f /tmy/mytest.sql  -T 300 postgres

PG Head             -   tps = 5309.810807 (excluding connections 
establishing).
PG HEAD+patch -  tps =  5751.745767(8.32+% vs. head)


pgbench -c 8 -j 8 -f /tmp/mytest.sql   -T 500 postgres

PG Head             -  tps = 7701.176220(excluding connections 
establishing).
PG HEAD+patch -  tps = 7953.934043(3.27+% vs. head)

-- 
regards,tushar
EnterpriseDB  https://www.enterprisedb.com/
The Enterprise PostgreSQL Company

Commits

  1. Replace binary search in fmgr_isbuiltin with a lookup array.

  2. Add inline murmurhash32(uint32) function.