pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS [...]
Date: Mon, 8 Jun 2020 08:35:04 -0500
Message-ID: <5fd32bf1-164c-742f-9e46-7c9cc547a0e1@gmail.com> (raw)
In-Reply-To: <1102807465.20200608101409@am-soft.de>
References: <1102807465.20200608101409@am-soft.de>

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.





view thread (11+ messages)  latest in thread

Message-ID: <5fd32bf1-164c-742f-9e46-7c9cc547a0e1@gmail.com>
Permalink:  ../5fd32bf1-164c-742f-9e46-7c9cc547a0e1@gmail.com/
Also on:    postgresql.org/message-id/5fd32bf1-164c-742f-9e46-7c9cc547a0e1@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS [...]
  In-Reply-To: <5fd32bf1-164c-742f-9e46-7c9cc547a0e1@gmail.com>
  References: <1102807465.20200608101409@am-soft.de> <5fd32bf1-164c-742f-9e46-7c9cc547a0e1@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox