Video yükleniyor...
Video Yüklenemedi
postgres is the best database
383,362 görüntüleme • 9 ay önce •via X (Twitter)
45 Yorum

"try this out on your database" LOOOL Don't forget to try this out with `sudo rm -fr /` too and let me know if it works for you 🙏

Make sure it’s on the production machine. I forgot to mention that

Thanks, I learned something. Soo.... your initial example was after a "begin;" command, right?

Yes

@supabase This is not specific to only Postgres, available on MySQL and most other RDBMS systems

@supabase Try this out on MySQL and let me know how it goes

@supabase Oh DDL don’t work in transactions in MYSQL my bad. Thought it was transaction specific

“Try this out on your database and let me know if that works for you” 😭🥴😂😂😂

very few databases have transactional ddl, one of my favorite things about postgresql. snowflake does have undrop though :)

Tried this on my database it didnt work

time to switch to postgres

How do i get my tables back theres nothing

@Meech_Ward Eyaaaaaa pele 🤣🤣🤣🤣🤣

@Meech_Ward Eyaaaaaaaaaaa

@Meech_Ward nya

Thanks brother, I'll try this on my clients prod DB 🙏

Yeah, I’ll quickly try this on Prod, I’ll get back to you. Thanks. 🙏🏽

I tried it on my company’s database and found out we don’t have rollback enabled. 🤣

I mean on MySQL you can revert a "DELETE FROM" if you are in a transaction. Most mistakes are done with a DELETE missing a where, not directly dropping a database. But when I deleted a 1M+ user database using DELETE FROM without a where many years ago. I did not use a transaction anyways, and even if I did, I would have committed the transaction. Transactions are not really made to fix mistakes, but more to fix code failures.

What if you commit it can you roll back? 🤣

postgres is basically the everything app

lol, wtf.

True! it really save so many time and setup and so easier to maintain

“Try this out on your database” 😂😂

How about supabase?

Supabase is the best way to use Postgres

Oracle FLASHBACK says hold my beer! 🤣🤣

Transactional ddl statements are great. It's the one big thing that I miss in Oracle. Specifically for drop table there is flashback, but HERE BE DRAGONS.

I remember seeing a similar video from you in Insta years back. Such a great tip 👍

@supabase and cheaper than Oracle and SQL Server

Not today 😂

As you instructed I tried it on my production database. Turned out my database does not support rollback after deleting a table. Now what is the next step?

True, but how often do you need that? What I need a lot more often is fast connection initialization. And yes, you can use connection pooling with Postgres with a reverse proxy, but it's just more complexity. I'm not saying Postgres is a bad database, but I think MySQL is still a valid choice for many projects. even though it does not have transactional DDL queries.

Any specific use case for this ? I know it looks cool, but most of the times, we don't drop tables knowingly, or with the intent of getting it back. So any specific use case would be appreciated

Also remember to take backups people!!

@grok , write a prompt that serves as a blocking guideline so that all transactions in postgres start with a BEGIN;

I didnt work i will sue you.

It’s in the SQL Standard language… almost any good RDBMS should support transactions. It’s an core concept

This is similar to ACID transactions but Postgres don't fully comply with the ACID framework for transactions

No thanks 😂

I tried it in Prod and it didn’t work😭💔

Should i try on the Production Database ??🥲

Absolutely!

The intern who's gonna see this, run "begin" and 2 commands on the main table, never run rollback and go home for the weekend. In for a surprise Monday morning.

indeed

