public inbox for [email protected]  
help / color / mirror / Atom feed
FK from logged to unlogged table?
2+ messages / 2 participants
[nested] [flat]

* FK from logged to unlogged table?
@ 2025-11-22 00:08  [email protected]
  0 siblings, 1 reply; 2+ messages in thread

From: [email protected] @ 2025-11-22 00:08 UTC (permalink / raw)
  To: [email protected]

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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: FK from logged to unlogged table?
@ 2025-11-22 12:34  David G. Johnston <[email protected]>
  parent: [email protected]
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2025-11-22 12:34 UTC (permalink / raw)
  To: [email protected] <[email protected]>; +Cc: [email protected] <[email protected]>

On Friday, November 21, 2025, <[email protected]> wrote:

> 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).
>
>
Both 1 and 2 Feels like something you should take the couple of minutes to
try.  For 3, it’s an unlogged table - the entire thing.

David J.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-11-22 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-11-22 00:08 FK from logged to unlogged table? [email protected]
2025-11-22 12:34 ` David G. Johnston <[email protected]>

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