On Tue, Nov 27, 2012 at 10:06 AM, Seref Arikan <
serefarikan@gmail.com> wrote:
> I have a function that creates a temp table, inserts rows into it, performs
> joins, and returns a single integer as a result. This is pg 9.1. All
> sessions are using the exact same temp table structure.
> re performance requirements: I need this function to return as fast as
> possible :) On a production server, if the function can complete in around
> 10-20 milliseconds, it would be really good (below 10 ms would be great).
> The average number of inserted into temp table is around 800, and there are
> about 10 columns in the current design.
Well, one thing to explore is use of CTE. general structure is: