|
|
|
Ask HN: Starting to love RDBMS-first design. Anyone else?
|
|
6 points
by thookipodu
664 days ago
|
|
I have been working on my side project for the last 10 months. My initial focus was on language, frameworks (elixir, liveview) during the initial months. Designing tables in rdbms (postgres) was out of necessity. For the last 2 months, usage of Stored procedures and postgresql functions just clicked. The feel of working with raw data inside the database instead of running around ORM hoops felt very liberating. Just realizing loops and conditionals are made unnecessary by SQL and the fact that abstraction layers can be built using views is quite addictive. I have deleted much of my UI code that I painstakingly wrote in elixir to SQL and it feels good. Interested to hear if someone has went down this path. Would like to hear if there are any gotchas in this approach ? |
|
1. Stored procedures are not automatically in an SCM. It takes good discipline to make sure they're properly committed, and synchronized with your databases.
2. Don't try to do too much with one view or query in general. This has bitten me many times. Don't be afraid to split-up a query. That can simply be a few separate queries, or creating a temporary table that's built up over multiple steps. It's more work up front, but the increased performance can be necessary.
I've come to adopt creating temporary stored procedures in my processes when I needed them. I find that's a nice balance when complex processing is more efficient and convenient to do in PostgreSQL rather than a round trip to Python.