Re: temporary table vs array performance - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: temporary table vs array performance
Date
Msg-id CAKFQuwZWDqyKEtDZ4U4g1vnsvcGa=N4tzeXgK0rK3naJKy3j=w@mail.gmail.com
Whole thread Raw
In response to temporary table vs array performance  ("dbyzaa@163.com" <dbyzaa@163.com>)
List pgsql-hackers
Its considered bad form to post to multiple lists.  Please pick the most relevant one - in this case I'd suggest -general.

On Mon, Sep 26, 2016 at 8:39 AM, dbyzaa@163.com <dbyzaa@163.com> wrote:

Array is not convenient to use in function, whether there are other methods can be replaced temp table in function


​I have no difficulty using arrays in functions.

As for "other methods" - you can use CTE (WITH) to create a truly local table - updating the catalogs by using a temp table is indeed quite expensive.

WITH vals AS  ( VALUES (1, 'lw'), (2, 'lw2') ) 
SELECT * FROM vals;

David J.

pgsql-hackers by date:

Previous
From: "dbyzaa@163.com"
Date:
Subject: temporary table vs array performance
Next
From: Enrique Meneses
Date:
Subject: Re: Allowing GIN array_ops to work on anyarray