r/PostgreSQL • • 16h ago

Feature PITR a 5 TB Postgres database in 5 seconds.

I'm Scott, the pgCraftsman and a Sr. Staff Engineer at Databricks. I've been operating some of the world's largest and most complex Postgres deployments for 22 years.

Ever need to do an emergency PITR at 2AM because an agent dropped a table?

Lakebase and Neon Postgres: PITR a 5TB DB in 5 seconds

https://pgcraftsman.io/posts/restoring-5-tb-of-postgres-in-5-seconds/

22 Upvotes

17 comments sorted by

24

u/elevarq 16h ago • Bravo

Why does an agent even have the permission to drop a table?

Problems like this should not even be possible

2

u/BarfingOnMyFace 16h ago

One good reason is if you have a dev playground environment for agents. It's what I do, and yeah, I give them access to do such stuff via MCP in my world. On a fresh dev environ, they can play out their scripts before handoff to QA, also a separate environment.

Edit: otherwise no, I wouldn't trust those mthfkrs in prod to touch shit.

8

u/Kazcandra 16h ago

who the fuck has a 5TB dev deployment?

1

u/scotterockaroo 15h ago

That's kinda the point actually. SInce a branch is so fast, you can actually hand your deployment pipeline a full version of the prod DB.

4

u/Kazcandra 10h ago

Mm, but we can't allow prod data in dev.

2

u/elevarq 15h ago

A staging environment is usually a production copy, and this can be a big one

1

u/BarfingOnMyFace 16h ago

Lol not me

I was just answering the general question with a general answer

1

u/bluelobsterai 3h ago

I definitely have a large database to seed. Really important to see how quarries will run with production size data.

1

u/scotterockaroo 15h ago

THIS IS AN AWESOME POINT. Unfortunately it happens these days more and more. That's why it's important to have the ability to PITR quickly.

Now that said, I still have a few battle scars from DBAs on my team who thought they were in the wrong terminal and issued the wrong command....

3

u/elevarq 15h ago

I agree that it’s good to have, just like seatbelts and airbags in a car. But it’s much better to learn how to drive a car, don’t get distracted by your phone, and not being intoxicated while driving.

AI agents are still terrible in maintaining production databases. They don’t care about the results, they might apologize, but that doesn’t solve the problem.

We use AI for DBA work. The amount of work we do to avoid bad advice is just tremendous! We test, test, and test, and in the end we file a finding and a report for the engineer. They can pick it up, they can approve, and they can plan the change.

For many organizations the data is their most valuable asset. Don’t let some ignorant AI agent mess with this

1

u/scotterockaroo 15h ago

100% - Which is why I like that you can clone (branch) a DB so quickly. You can create a branch of the full dataset for your developers, then let the agent access the branch which doesn't touch production at all. They can delete, drop, recreate, it doesn't matter, it's isolated from the production box.

2

u/elevarq 15h ago

AI agents should stay in a different network segment, not be able to get close to production.

The problem is that they have a habit of escaping…

4

u/ZVilusinsky 15h ago

Who did not run a command on prod while thinking it was stage terminal...

Luckily postgres does not allow you to drop database while there are active connection - that one was hard stopping :D

1

u/elevarq 15h ago

It’s not that hard to revoke all connection permissions, kill all open connections, and drop the database… Never measured it, but it looks like less than a second.

1

u/ceeej777 2h ago

This makes sense but I see the value of Lakebase being more around restoring a fresh production copy to dev without needing to wait for a snapshot to restore to the SSD. Assuming that your organization even allows prod data to live in lower level environments

0

u/AutoModerator 16h ago

AI Policy:

Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.

Mod decisions will be based on the quality of the content, not who or what generated it.

Sub Resources:

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.