Re: Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS [...]

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS [...]
Date: 2020-06-08 13:35:04
Message-ID: 5fd32bf1-164c-742f-9e46-7c9cc547a0e1@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 6/8/20 3:14 AM, Thorsten Schöning wrote:
> Hi all,
>
> I have an app exposing web services to generate reports. Those web
> services accept multiple reports per request and calculate them
> concurrently. There's one transaction spanning each entire request and
> used by ALL spawned threads. The app makes sure that e.g. committing
> transactions is handled by ONE thread only and individual statements
> are NEVER reused by multiple threads.
>
> There are two types of reports: Some need to read data from the DB
> themself, others can work on the data provided by the former ones. The
> current implementation always creates temporary tables for results of
> some query, so that one can simply check if some temporary table is
> available and either only query that or create it before as necessary.
>
> I'm using "CREATE TEMP TABLE IF NOT EXISTS [...] AS [...]" and the
> associated queries can take a long time.

Would a set of GLOBAL temporary tables be a better fit for your problem
(eliminating the need to create temporary tables each time)?

--
Angular momentum makes the world go 'round.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thorsten Schöning 2020-06-08 14:09:44 Re: Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS [...]
Previous Message Thomas Kellerer 2020-06-08 13:20:32 Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ?