Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sOoA3-001Irf-Gl for pgsql-general@arkaria.postgresql.org; Wed, 03 Jul 2024 00:47:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sOo9z-0053hB-Lt for pgsql-general@arkaria.postgresql.org; Wed, 03 Jul 2024 00:47:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sOo9z-0053h2-9H for pgsql-general@lists.postgresql.org; Wed, 03 Jul 2024 00:47:48 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sOo9y-0008Nj-1L for pgsql-general@lists.postgresql.org; Wed, 03 Jul 2024 00:47:47 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a72988749f0so717583666b.0 for ; Tue, 02 Jul 2024 17:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ridewithvia.com; s=google; t=1719967664; x=1720572464; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=/MPhf4yXPXDInYmGN1YgLoxD/VGRXlXyFnJZOp/SWJA=; b=V435r2YAj8MPldy9HsNoIW03Zjgy1LUkALU84GH8MrVo1TAFcEXhi1X4noPtjPhCUH eyHwuwqxQkMngpIw3q7l4Na9sn/2BcmzCqNHybMq3IFH0O9p2DX9O893JBJJI7+Wt1Bl ydHEQwvWHL1sGvrMXSCNhPSlC0B0b7NR36dUA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719967664; x=1720572464; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/MPhf4yXPXDInYmGN1YgLoxD/VGRXlXyFnJZOp/SWJA=; b=ow/VCVzXbPRuEz/FUV8phdjL+NteAIpCnxNFC4nVEDzKhn7xKgpZh2wA3PZJUQlYlX E3yJnKiKyPUmCIY7U4l1wssmChte1w02+IafTBvZDMtqjlgpvalmvf5EVk+Bcad/sqmB gf/S0D8RwO8JJ7kTpZABfbkyNTz94sEhc7BeMlTj0J+/s9nBM9WWKHUE1VqSae5N7Y6f XdB0HBxL/ofh1V3Q5G6F8FGTEXUrZOlWeumgbdYyuKk5Wwl2iNWfEPJ6kxBpdMlfOKSP dRVgeJ2PVWcZi30wTimJ6chSFW33jrtsiQKXgLFHQgOkX88JmATqVxtxXiE+YITc1aXV Hp3w== X-Gm-Message-State: AOJu0YyT5GwbJacogkOjohx3QBg6fusCjxitiSoNW++IQ2OeCFmFmmz1 1KtTGoHkL4jD8TeQ2D/ekEM6lCWRdUb5jIO6QUZ2f+nDUZFG71BcHFqO6RaNavTYxdNpIHG0VVu WxXK5SxtgJZAQnDcwyNUY2g00qHeNj8HqSj3Rstuf50Q2QVNUshVhx6yMyi8n7AdVk/pbbUZb9Z tDh8S+v10Jq4Xjr7ZRvOfjay3rPwlSLArvWwhaj7XKc5GRhy+4Ocs= X-Google-Smtp-Source: AGHT+IE2Of479o0Q81YMs6Fn4kzMVyDSN+vLEKPqBCesoGrmRhIba1RJXaE5nh9ElK2SsoJp1bBKjUg5Ar+SZTLlFvk= X-Received: by 2002:a17:906:f599:b0:a6f:e111:a152 with SMTP id a640c23a62f3a-a75144f5d4bmr779086966b.62.1719967664020; Tue, 02 Jul 2024 17:47:44 -0700 (PDT) MIME-Version: 1.0 From: Stuart Campbell Date: Wed, 3 Jul 2024 10:47:32 +1000 Message-ID: Subject: Logical replication with temporary tables To: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000a3bacd061c4d2d4d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a3bacd061c4d2d4d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, I'm trying to use a blue/green deployment in Amazon RDS, which uses Postgres logical replication to keep blue and green environments in sync. Some parts of our app use temporary tables, and in some cases we CREATE INDEX on those tables and sometimes DROP and recreate them. The CREATE INDEX and DROP TABLE statements are causing problems with the blue/green replication. (They are detected by RDS, and cause the deployment to be marked as "degraded" and subsequently unusable.) My (limited) understanding is that this happens because CREATE TEMPORARY TABLE doesn't get written to the WAL, but the other statements do. My question is whether there is some workaround that will let me create indexes on a temporary table, and also let me drop the temporary table, in a way that doesn't end up "degrading" replication? (Presumably that means avoiding writing to the WAL?) I've discovered that I can at least create a primary key inline as part of the temporary table definition, which gives me a way to create a single (unique) index, i.e.: CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY, =E2=80=A6) But I haven't discovered a way to drop the table, or to create other indexes. Cheers, Stuart --=20 This communication and any attachments may contain confidential information= =20 and are intended to be viewed only by the intended recipients. If you have= =20 received this message in error, please notify the sender immediately by=20 replying to the original message and then delete all copies of the email=20 from your systems. --000000000000a3bacd061c4d2d4d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

I'm trying to use= a blue/green deployment in Amazon RDS, which uses Postgres logical replica= tion to keep blue and green environments in sync.

<= div>Some parts of our app use temporary tables, and in some cases we CREATE= INDEX on those tables and sometimes DROP and recreate them.

=
The CREATE INDEX and DROP TABLE statements are causing problems = with the blue/green replication. (They are detected by RDS, and cause the d= eployment to be marked as "degraded" and subsequently unusable.)<= /div>

My (limited) understanding is that this happens be= cause CREATE TEMPORARY TABLE doesn't get written to the WAL, but the ot= her statements do.

My question is whether ther= e is some workaround that will let me create indexes on a temporary table, = and also let me drop the temporary table, in a way that doesn't end up = "degrading" replication? (Presumably that means avoiding writing = to the WAL?)

I've discovered that I can at lea= st create a primary key inline as part of the temporary table definition, w= hich gives me a way to create a single (unique) index, i.e.:

=
=C2=A0=C2=A0=C2=A0 CREATE TEMPORARY TABLE foo (id INT PRIMARY KE= Y, =E2=80=A6)

But I haven't discovered a way t= o drop the table, or to create other indexes.

Chee= rs,
Stuart

This communication and any attachments may contain confidential inform= ation and are intended to be viewed only by the intended recipients. If you= have received this message in error, please notify the sender immediately = by replying to the original message and then delete all copies of the email= from your systems.


--000000000000a3bacd061c4d2d4d--