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@xxxxxxxxxxxxxx> 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).