Re: "append" takes a lot of time in a query - Mailing list pgsql-performance

From Scott Marlowe
Subject Re: "append" takes a lot of time in a query
Date
Msg-id dcc563d10805211144i592bd400m43238c5def8eae66@mail.gmail.com
Whole thread Raw
In response to Re: "append" takes a lot of time in a query  (Frank Dekervel <frank.dekervel@smartlounge.be>)
List pgsql-performance
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).

pgsql-performance by date:

Previous
From: Albert Cervera Areny
Date:
Subject: Re: Posible planner improvement?
Next
From: "H. Hall"
Date:
Subject: Re: "Big O" notation for postgres?