Patch for fast gin cache performance improvement

From: Ian Link <ian(at)ilink(dot)io>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Patch for fast gin cache performance improvement
Date: 2013-06-18 04:42:37
Message-ID: 51BFE53D.9050008@ilink.io
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

*

This patch contains a performance improvement for the fast gin cache. As
you may know, the performance of the fast gin cache decreases with its
size. Currently, the size of the fast gin cache is tied to work_mem. The
size of work_mem can often be quite high. The large size of work_mem is
inappropriate for the fast gin cache size. Therefore, we created a
separate cache size called gin_fast_limit. This global variable controls
the size of the fast gin cache, independently of work_mem. Currently,
the default gin_fast_limit is set to 128kB. However, that value could
need tweaking. 64kB may work better, but it's hard to say with only my
single machine to test on.

On my machine, this patch results in a nice speed up. Our test queries
improve from about 0.9 ms to 0.030 ms. Please feel free to use the test
case yourself: it should be attached. I can look into additional test
cases (tsvectors) if anyone is interested.

In addition to the global limit, we have provided a per-index limit:
fast_cache_size. This per-index limit begins at -1, which means that it
is disabled. If the user does not specify a per-index limit, the index
will simply use the global limit.

I would like to thank Andrew Gierth for all his help on this patch. As
this is my first patch he was extremely helpful. The idea for this
performance improvement was entirely his. I just did the implementation.
Thanks for reading and considering this patch!*

Ian Link

Attachment Content-Type Size
gin-fast-perf.sql text/plain 1.5 KB
fastgin_mem.patch text/plain 9.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2013-06-18 04:51:23 Re: Patch for fail-back without fresh backup
Previous Message Jeff Janes 2013-06-18 04:06:08 Re: SET work_mem = '1TB';