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.96) (envelope-from ) id 1vMlb1-001VIM-3B for pgsql-general@arkaria.postgresql.org; Sat, 22 Nov 2025 11:16:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vMlaz-00BLMJ-1c for pgsql-general@arkaria.postgresql.org; Sat, 22 Nov 2025 11:16:01 +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.96) (envelope-from ) id 1vMbAy-00AB2F-13 for pgsql-general@lists.postgresql.org; Sat, 22 Nov 2025 00:08:28 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vMbAw-000o7L-0n for pgsql-general@lists.postgresql.org; Sat, 22 Nov 2025 00:08:28 +0000 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-3437c093ef5so2785601a91.0 for ; Fri, 21 Nov 2025 16:08:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=directdemocracysolutions.com; s=google; t=1763770103; x=1764374903; darn=lists.postgresql.org; h=mime-version:subject:message-id:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=+j9j2YzVNyeQl7oi1jU7RxT4HzN6V5cvagb8vVimVH4=; b=cFuDOO1c/gxvEnh15musVXAPztBHUwDmhIK855G3WiIwnb9loMhjEkcIlhob4Q6VmE pK3kMlzYNuym2KeHGyaMeyBCAJayssH6bQdXj+W45fJRnITYtOdNVb7OzHr3AbpXgmx3 com0HMCJUr//Js9hbByfnJPFhT+EAZuvlOJ5yzKD0nuBEGQw/e5YWwt1wJDV4qObfll5 xwvq+KYuoollD/GTfMoQBGkIM3zpsARXoCL2/cZoYMaIKO0uykHh+doNmwDA04eaGIld HzTpdMh9g0nud78c9R9YN+eUosFirLOUFzzkiPVn5GhAOfzMihCmJV61QbiYQ52ZkQkJ zGcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763770103; x=1764374903; h=mime-version:subject:message-id:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+j9j2YzVNyeQl7oi1jU7RxT4HzN6V5cvagb8vVimVH4=; b=iWLdH29qyz50JkbHe0ST00oA4nmAL0r8w79IAcvTnYlc1iuzZPtOQAsAC2WpyhwgZh 3GBOuurJND1PmhUicYoAqcwMk6WR0G+zk5Vr8atVkbXtgCskl/23LgLjkbCCCGKw4ugK cOxfJEL71vI98vfukumVUoRrkCUcCkgJEGymIkkhYg0z75M0BS/2tegBTHMoRBTTmGCl beBQY/U65sy8ftsEonBANzYMEbwEDsa/EezS/QYS9RrmE2qCnhBAx6cSOaNZmxXlk0J/ keEFhKzhIT7AOS79zlIDgEdOEgIBS2yZgvwBv2hu8J+7YOSCWgKK1ZVEAm1Ob+9SKd3N 6lFw== X-Gm-Message-State: AOJu0YzAxqhSUGJ4BKPXnIzrzPVFa5i3MH2TebnC14JbRPS8WmvfNTuJ RLqTO76EgY8s8t8oKtNSc2wvixUIgs1HOK1P77yP1bMyN6GcrfQ+VpqCTnQi8tbHZMWX27VKy66 47gJ/ X-Gm-Gg: ASbGncu6krR3aOapFqyAaaExYj/2Kqhpgi2eDa1sd3tGK1NvMTBEs99Yw7qqQYBErJf wZhmpJsEPDujRWPlKQhuM9uMcBHe96vkj/U4WVtCn/vItB+KHXNJ8tAqnnQXhEdSnZ7jdAAB4wa UhJCefTo5wedDNFLGlwsOEBPTVLugYpS4ptfWqjv8kK97BQLAb69HkS/Ll37s7pWi8VhYNMopK5 ZP6LbMLjgWK4OvLYHCUKO9ZyHXYyVDvXJzfEi5RB9sUqbcELAaNcCINYM7aOA5+x3FBZUEyqfzk oUA0ZuM9EgqHOrf633FeAQLM/6KQQ0NavuHFgqFmeGiOL7iz1z/ONo/guZPQFYo3RxYSypq2jTn cZsPodr+NlSz0/vR6DrgPwogMu1SSBTcWagpm/lt+ADKguLmLRb9fYsBLcQRZ4wztIPcbn7gxVS b7GhKyYySCXUcnW96vw6PzT+hWVj5oyAxvFEiSm08ziYxj+iF8mArdDP9qGO5s4opB2DF+vz9hb T+DLJQT/2u/O6FQeM4= X-Google-Smtp-Source: AGHT+IG+VRxXQbcQ4kL+p7c/dE1etuSiTOWtcOtNRQHCIIUDvN8MvChgekX2CwhACuR8hB6XHo9vrw== X-Received: by 2002:a05:7022:f31a:b0:119:e569:f27a with SMTP id a92af1059eb24-11c9d865b88mr1090971c88.35.1763770102970; Fri, 21 Nov 2025 16:08:22 -0800 (PST) Received: from [10.1.10.122] (c-98-239-79-232.hsd1.ca.comcast.net. [98.239.79.232]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11c93e5674csm32276953c88.8.2025.11.21.16.08.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Nov 2025 16:08:22 -0800 (PST) Date: Fri, 21 Nov 2025 16:08:15 -0800 From: dolan@directdemocracysolutions.com To: pgsql-general@lists.postgresql.org Message-ID: <5031a50c-aca7-4512-9478-95583606b5ff@Spark> Subject: FK from logged to unlogged table? X-Readdle-Message-ID: 5031a50c-aca7-4512-9478-95583606b5ff@Spark MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="6920fef4_51bf6b48_20e3" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --6920fef4_51bf6b48_20e3 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, I'm looking to improve bulk write performance on a table of about 23 million rows by setting it unlogged. If lost, the table can be re-generated from archived raw data. The unlogged table would be referenced from a different, logged, table by a sparse but very important foreign key. If the unlogged table is lost, I can repair the foreign key data by re-uploading the raw data and following a different unique key. However, this would be annoying and I would rather not have to implement it if I can protect the keyed records instead. 1. Is it allowed to key from a logged table to an unlogged table? 2. What is the system behavior if the unlogged table is lost? 3. Is there a clean way to protect only the subset of records that are keyed? (Yes, I am considering periodic backups to an archive table, but there would still be some repair needed that way). Thanks! Nice to meet you all. -Dolan --6920fef4_51bf6b48_20e3 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hello,
&=23160;
I'm looking to improve bulk write performance on a table of about 23= million rows by setting it unlogged. If lost, the table can be re-genera= ted from archived raw data. The unlogged table would be referenced from a= different, logged, table by a sparse but very important foreign key.
&=23160;
If the unlogged table is lost, I can repair the foreign key data by = re-uploading the raw data and following a different unique key. However, = this would be annoying and I would rather not have to implement it if I c= an protect the keyed records instead.
  1. Is it allowed to key from a logged table to an unlogged table=3F
  2. =
  3. What is the system behavior if the unlogged table is lost=3F
  4. Is there a clean way to protect only the subset of records that are k= eyed=3F (Yes, I am considering periodic backups to an archive table, but = there would still be some repair needed that way).
&=23160;
Thanks=21 Nice to meet you all.
-Dolan
--6920fef4_51bf6b48_20e3--