Small catcache optimization

Started by Andres Freundover 12 years ago2 messageshackers
Jump to latest
#1Andres Freund
andres@anarazel.de

Hi,

Heikki's catcache rehashing stuff reminded me that I'd posted an
optimization to catcache (20121220153555.GH4303@awork2.anarazel.de) some
time back which I didn't have energy to pursue at that point.

I've brushed the patch up a bit and verified it still gives be a
performance improvement. It's still about 2% in a readonly pgbench on my
elderly laptop.

There's basically two tricks in the patch:
1) Don't always copy the cache's ScanKey to the stack. Instead pass
an array of arguments around. That get's rid of a good amount of
memcpy()ing in the common, cached case.
2) If we have to memcpy() because we need to pass a ScanKey to
systable_*, copy only cache->cc_nkey * sizeof(ScanKeyData) instead of
always copying the maximum size.

I'd be nicer to get rid of the mostly copied HeapKeyTestArg, but I don't
immediately see how.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachments:

0001-Improve-catalog-cache-lookup-performance.patchtext/x-patch; charset=us-asciiDownload+122-55
#2Bruce Momjian
bruce@momjian.us
In reply to: Andres Freund (#1)
Re: Small catcache optimization

On Thu, Sep 5, 2013 at 09:13:23PM +0200, Andres Freund wrote:

Hi,

Heikki's catcache rehashing stuff reminded me that I'd posted an
optimization to catcache (20121220153555.GH4303@awork2.anarazel.de) some
time back which I didn't have energy to pursue at that point.

I've brushed the patch up a bit and verified it still gives be a
performance improvement. It's still about 2% in a readonly pgbench on my
elderly laptop.

There's basically two tricks in the patch:
1) Don't always copy the cache's ScanKey to the stack. Instead pass
an array of arguments around. That get's rid of a good amount of
memcpy()ing in the common, cached case.
2) If we have to memcpy() because we need to pass a ScanKey to
systable_*, copy only cache->cc_nkey * sizeof(ScanKeyData) instead of
always copying the maximum size.

I'd be nicer to get rid of the mostly copied HeapKeyTestArg, but I don't
immediately see how.

Where are we on this?

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers