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

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Thorsten Schöning" <tschoening(at)am-soft(dot)de>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Concurrenctly running CREATE TEMP TABLE IF NOT EXISTS [...] AS [...]
Date: 2020-06-08 10:07:53
Message-ID: 555f2665-0880-4d63-9314-b73521b8c5e8@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thorsten Schöning wrote:

> > The caveat you mention about IF NOT EXISTS does not apply to
> > temporary tables, as they're not shared across sessions.[...]
>
> That's what I understood as well, but I'm creating those concurrently
> WITHIN one and the same session and transaction. :-)

But a SQL session on the server takes its statements from a FIFO queue
and processes them serially, so there's no intra-session concurrency.
In fact multi-threaded SQL clients *must* make sure that they don't
send concurrent queries to the same connection. The best they can
do in terms of throughput is to queue up a new query while
the server is busy executing a previous one, but that's pipelining,
not parallelism.

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: https://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laura Smith 2020-06-08 10:17:07 Postgres 12 RLS
Previous Message Michaeldba@sqlexec.com 2020-06-08 09:50:35 Re: When to use PARTITION BY HASH?