From: Scott Marlowe <scott.marlowe@gmail.com>
To: Frank Dekervel <frank.dekervel@smartlounge.be>
Cc: pgsql-performance@postgresql.org
Subject: Re: "append" takes a lot of time in a query
Date: Wed, 21 May 2008 12:44:44 -0600
Message-ID: <dcc563d10805211144i592bd400m43238c5def8eae66@mail.gmail.com> (raw)
In-Reply-To: <200805211237.23178.frank.dekervel@smartlounge.be>
References: <200805091009.46893.frank.dekervel@smartlounge.be>
<13354.1210342366@sss.pgh.pa.us>
<200805161759.38066.frank.dekervel@smartlounge.be>
<200805211237.23178.frank.dekervel@smartlounge.be>
I think you're looking to return set of record or something like that.
On Wed, May 21, 2008 at 4:37 AM, Frank Dekervel
<frank.dekervel@smartlounge.be> wrote:
> Hello,
>
> Small update on this problem:
>
> Wouter Verhelst came to help debugging, and he determined that the 2 seconds
> were spent planning the query and not executing the query. (executing the
> query is quick as seen in the query plan).
>
> To avoid replanning this query all the time, Wouter suggest replacing the
> query with a stored procedure (so that the query plan was saved). We did a
> proof of concept, and it seemed to work very well.
>
> Another approach would be caching of prepared statements, but i found no
> implementations of this on the net.
>
> We now still need to find a way to hook the stored procs in our O-R mapper:
> generating them the first time a query is done (fairly easy), and
> making "select procname(param1,param2)" behave like a normal query.
>
> We tried a stored procedure returning a cursor and this seemed to work, but
> we'd like to avoid this as, to use cursors, we need to change the core logic
> of our system that decides whether to use transactions and cursors (now the
> system does not create a cursor if it does not expect too many rows coming
> back and so on, and no transaction if no "update" or "insert" queries have to
> be done).
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: scott.marlowe@gmail.com, frank.dekervel@smartlounge.be
Subject: Re: "append" takes a lot of time in a query
In-Reply-To: <dcc563d10805211144i592bd400m43238c5def8eae66@mail.gmail.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