Re: Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS[...] - Mailing list pgsql-general

From Ron
Subject Re: Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS[...]
Date
Msg-id 5fd32bf1-164c-742f-9e46-7c9cc547a0e1@gmail.com
Whole thread Raw
In response to Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS [...]  (Thorsten Schöning <tschoening@am-soft.de>)
Responses Re: Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS [...]  (Thorsten Schöning <tschoening@am-soft.de>)
List 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.



pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: "INSERT ON CONFLICT UPDATE" - Use of indexes ?
Next
From: Thorsten Schöning
Date:
Subject: Re: Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS [...]