Re: Temporary tables usage in functions

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Yambu <hyambu(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Temporary tables usage in functions
Date: 2020-11-09 17:18:59
Message-ID: CAHOFxGrOc82haHj=fuZoObkjggC2XutwiKP00eSgTumKQQLojw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> Also may I know if excessive use of temporary tables may cause locks?
>>
>
> Usually there are no problems with locks, but there is a problem with
> system tables bloating. Creating and dropping temp tables is expensive like
> creating or dropping normal tables.
>

Dropping a real table requires scanning all of shared_buffers, right? I
wouldn't think dropping a temp table requires that kind of heavy operation
because it should be stored within separate temp_buffers.

Against other databases, there can be used arrays instead temporary tables.
> This is significantly more effective.
>

Can you expand on this point? What do you mean? Like using a values
statement rather than temp table? I find that I often need to create a temp
table and analyze it to allow the planner to make wise decisions.

>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Susan Hurst 2020-11-09 17:21:29 Re: Foreign Data Wrapper Handler
Previous Message Laurenz Albe 2020-11-09 17:12:08 Re: Foreign Data Wrapper Handler