pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andy Halsall <halsall_andy@hotmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: query overhead
Date: Fri, 13 Jul 2012 12:15:07 -0400
Message-ID: <3893.1342196107@sss.pgh.pa.us> (raw)
In-Reply-To: <BLU123-W2825EA0DA3346EA0D91091F5D10@phx.gbl>
References: <BLU123-W2825EA0DA3346EA0D91091F5D10@phx.gbl>

Andy Halsall <halsall_andy@hotmail.com> writes:
> I've written an Immutable stored procedure that takes no parameters and returns a fixed value to try and determine the round trip overhead of a query to PostgreSQL. Call to sp is made using libpq. We're all local and using UNIX domain sockets.
 
> Client measures are suggesting ~150-200 microseconds to call sp and get the answer back

That doesn't sound out of line for what you're doing, which appears to
include parsing/planning a SELECT command.  Some of that overhead could
probably be avoided by using a prepared statement instead of a plain
query.  Or you could try using the "fast path" API (see libpq's PQfn)
to invoke the function directly without any SQL query involved.

Really, however, the way to make things fly is to get rid of the round
trip overhead in the first place by migrating more of your application
logic into the stored procedure.  I realize that that might require
pretty significant rewrites, but if you can't tolerate per-query
overheads in the 100+ usec range, that's where you're going to end up.

If you don't like any of those answers, maybe Postgres isn't the
solution for you.  You might consider an embeddable database such
as SQLLite.

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <3893.1342196107@sss.pgh.pa.us>
Permalink:  ../3893.1342196107@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3893.1342196107@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, halsall_andy@hotmail.com
  Subject: Re: query overhead
  In-Reply-To: <3893.1342196107@sss.pgh.pa.us>

* 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