Skip site navigation (1) Skip section navigation (2)

Re: plpython3 perf

From: James William Pye <lists(at)jwp(dot)name>
To: jd(at)commandprompt(dot)com
Cc: Greg Smith <greg(at)2ndquadrant(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Josh Berkus <josh(at)agliodbs(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plpython3 perf
Date: 2010-01-21 02:32:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Jan 14, 2010, at 2:03 PM, Joshua D. Drake wrote:
> What I would (as a non hacker) would look for is:
> (1) Generalized benchmarks between plpython(core) and plpython3u
> I know a lot of these are subjective, but it is still good to see if
> there are any curves or points that bring the performance of either to
> light.

k, it was pretty much as expected. However, the surprise for me was that @pytypes didn't perform as terribly as I expected it to. I imagine it's impact may become more noticeable with more parameters, but, nonetheless, I was surprised. I didn't do any SRF tests, but the installations are still setup, so if anyone really wants to see that, it shouldn't take long to do.

Apologies ahead of time for the lack pretty graphs. =)

I used two different builds/installations of PG to test as the PL names conflict. Both were compiled with the following CFLAGS(pg_config output):

-O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv

Both PLs were built against the same build of Python(recent svn update of release31-maint):

Python 3.1.1+ (release31-maint:77585M, Jan 17 2010, 10:29:13) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin

I ran each of the test files a few times against the target installation, but I only attached one of each to this message. (Primarily, multiple runs to filter out any spurious spikes.)

The source SQL and output files are attached.

rawtest.sql.out is the output for raw data objects(native typing).
pytypestest.sql.out is the output of the @pytypes test(native typing with conversion overhead).
plpythontest.sql.out is the output for core's plpython(conversion).

A few samples from the output files are included inline below.

Each volatile function is called 100,000 times from a COUNT() aggregate, and the duration is measured using psql's \timing. Most of the functions simply return the first parameter given to it. The functions are ran inside a transaction because plpython3 does some cache clears(linecache) and GC at the end of transactions.

The parameter type, if any, is indicated by the label:


	raw: 125ms
	pytypes: 372ms (base overhead, it would appear)
	plpython: 309ms


	raw: 140ms
 	pytypes: 684ms
	plpython: 750ms


	raw: 145ms
	pytypes: 676ms
	plpython: 718ms


	raw: 271ms
	pytypes: 2766ms
	plpython: 2310ms


	raw: 235ms
	pytypes: 795ms (N/A, no conversion done, but takes a bit of a hit anyways)
	plpython: 1654ms

Attachment: plpythontest.sql.out
Description: application/octet-stream (856 bytes)
Attachment: pytypestest.sql.out
Description: application/octet-stream (868 bytes)
Attachment: rawtest.sql.out
Description: application/octet-stream (866 bytes)
Attachment: pytypestest.sql
Description: application/octet-stream (2.2 KB)
Attachment: rawtest.sql
Description: application/octet-stream (2.1 KB)
Attachment: plpythontest.sql
Description: application/octet-stream (2.1 KB)

In response to


pgsql-hackers by date

Next:From: Jaime CasanovaDate: 2010-01-21 02:32:08
Subject: Re: WARNING: pgstat wait timeout
Previous:From: Jeff DavisDate: 2010-01-21 02:06:57
Subject: Re: Listen / Notify - what to do when the queue is full

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group