pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-performance@postgresql.org
Subject: SRFs ... no performance penalty?
Date: Mon, 20 Oct 2003 17:55:12 -0700
Message-ID: <200310201755.12713.josh@agliodbs.com> (raw)

Folks,

I'm working on the demo session for our upcoming presentation at PHPCon.  

As a side issue, we ended up comparing 3 versions of the same search screen:

1) All in PHP with views;
2) Using a function to build a query and count results but executing that 
query directly and sorting, paging in PHP;
3) Using a Set Returning function to handle row-returning, sorting, and 
paging.

All three methods were executing a series moderately complex query against a 
medium-sized data set (only about 20,000 rows but it's on a laptop).  The 
postgresql.conf was tuned like a webserver; e.g. low sort_mem, high 
max_connections.

So far, on the average of several searches, we have:

1) 0.19687 seconds
2) 0.20667 seconds
3) 0.20594 seconds

In our tests, using any kind of PL/pgSQL function seems to carry a 0.01 second 
penalty over using PHP to build the search query.   I'm not sure if this is 
comparitive time for string-parsing or something else; the 0.01 seems to be 
consistent regardless of scale.

The difference between using a PL/pgSQL function as a query-builder only (the 
7.2.x method) and using SRFs was small enough not to be significant.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




view thread (3+ messages)  latest in thread

Message-ID: <200310201755.12713.josh@agliodbs.com>
Permalink:  ../200310201755.12713.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200310201755.12713.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: josh@agliodbs.com
  Subject: Re: SRFs ... no performance penalty?
  In-Reply-To: <200310201755.12713.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox