PostgreSQL is not just a relational db, but an object-relational db ⚡

Arpit Bhayani

Arpit Bhayani

Apr 16, 2024 • 1 min read


PostgreSQL is not just a relational db, but an object-relational db ⚡

It has a super-cool feature that allows us to create user-defined types and define behaviors (functions) on them. This way, you get the best of both worlds - an ability to organize data into rows and columns and define complex types right in your database.

For example, you can define a type “Book” with fields like id, title, and author and also functions “is_available” on it that when invoked fires another query to check the availability. Pretty cool isn’t it?

Although this means we are keeping fragments of business logic in the database, if it is something invoked more frequently and which rarely changes, then you can dramatically reduce the response time and improve performance by leveraging this.

⚡ I keep writing and sharing my practical experience and learnings every day, so if you resonate then follow along. I keep it no fluff.

youtube.com/c/ArpitBhayani

Arpit Bhayani

Principal Engineer II at Razorpay - building Agent Studio, Ex-staff engg at GCP Memorystore & Dataproc, Creator of DiceDB, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses