Re: [HACKERS] temporary table vs array performance

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "dbyzaa(at)163(dot)com" <dbyzaa(at)163(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-performance <pgsql-performance(at)postgresql(dot)org>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: [HACKERS] temporary table vs array performance
Date: 2016-09-26 15:49:42
Message-ID: CAKFQuwZWDqyKEtDZ4U4g1vnsvcGa=N4tzeXgK0rK3naJKy3j=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-performance

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(at)163(dot)com <dbyzaa(at)163(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2016-09-26 16:16:31 Re: [HACKERS] temporary table vs array performance
Previous Message dbyzaa@163.com 2016-09-26 15:39:11 temporary table vs array performance

Browse pgsql-hackers by date

  From Date Subject
Next Message Enrique Meneses 2016-09-26 16:04:05 Re: Allowing GIN array_ops to work on anyarray
Previous Message dbyzaa@163.com 2016-09-26 15:39:11 temporary table vs array performance

Browse pgsql-performance by date

  From Date Subject
Next Message Knels, Udo 2016-09-26 15:59:58 Re: Problem with performance using query with unnest after migrating from V9.1 to V9.2 and higher
Previous Message dbyzaa@163.com 2016-09-26 15:39:11 temporary table vs array performance