I will admit things feel a little sluggish right now, despite _much_ better hardware, but PostgreSQL is live on :netbsd: and everything else is modernized too.
Happy patch day! (Every day is patch day).
I will admit things feel a little sluggish right now, despite _much_ better hardware, but PostgreSQL is live on :netbsd: and everything else is modernized too.
Happy patch day! (Every day is patch day).
So, some follow up -- during the restore from backup 9 foreign key constraints failed to apply.
This is due to work that I undertook in March 2023 after I lost some data and had to sketchily restore it into a running instance: https://tiny.tilde.website/@insom/110030644607199692
To do that, I relaxed FK constraints and, to the surprise of no-one, some invalid data is there.
Three years later I am fixing this up! I've learned about NOT VALID CONSTRAINTS since then, from my work at Slice.
You can add a constraint in two parts with PostgreSQL: one for new data being added (not valid) and then later you can do `alter table ... validate constraint` to ensure that historical data is validated.
I would have loved this in MySQL for making fields UNIQUE, something that was extremely toil-filled when I worked at Shopify.
Anyway, I've added those 9 as NOT VALID so that we don't add _new_ invalid data, to give me a chance to clean up.
I wrote a simple query to find the `media_attachments` which are referencing accounts that no longer exist on our server. This took a long time, so I went to Home Depot to buy stuff I need for an IRL project.
I got a text message to my phone about the chassis being too warm 😅 -- when I came back an hour later it hadn't finished.
Then I rewrote the `IN` to be a `LEFT JOIN` and it ran in 9 seconds. Still got it.
Some tables are bigger so I'll be carrying on this evening; just thought I'd share.
And we're done. High five to 2023's @insom -- working across the years to fix the data I fucked up.
```
postgres=> select count(*) from pg_constraint where not convalidated;
count
-------
0
(1 row)
```
@insom only 36 more cves until Christmas!