4 ms·
I've been attempting to preach the PostgreSQL Gospel (http://www.brightball.com/articles/why-should-you-learn-postgresql http://www.brightball.com/articles/why-
by brightball 10y ago
I've been attempting to preach the PostgreSQL Gospel (http://www.brightball.com/articles/why-should-you-learn-postgresql http://www.brightball.com/articles/why-should-you-learn-post...) for a few years now about this exact same thing.
When you look at your database as a dumb datastore, you're really selling short all of the capabilities that are in your database. PG is basically a stack in a box.
Whenever I started getting into Elixir and Phoenix and realized that the entire Elixir/Erlang stack was also basically a full stack on it's own...and that by default Phoenix wants to use PG as it's database...I may have gone a little overboard with excitement.
If you build with Elixir and PostgreSQL you've addressed almost every need that most projects can have with minimal complexity.
- qaq 10y agoVery true, the only downside to PG is a bit of naming craziness still using names from pre SQL days for some things, but overall very solid product.
- ibotty 10y agocare to give a few examples?
- qaq 10y agotuple - row, relation - table
- dragonwriter 10y agoPG calls tables "tables". It does refer to "relation" as the general term for a class of objects that includes tables and views, both of which are realizations of the abstract concept of a "relation" from relational database theory.
- josho 10y agoThis reminds me of the days of J2EE containers where we tried to write applications that never took advantage of vendor specific features so that our applications could be portable across application servers and databases. It was extremely rare to swap out from IBM to Oracle or vice versa but conceptually we could. The upside was that when a vendor's licensing fees became prohibitive we could conceptually swap platforms. The downside was, well plenty. Like dealing with generic errors, building your own services that the platform stack already provided. So, I love that we now have a OSS stack that folks are taking full advantage of rather than trying to abstract away the platform.
- brightball 10y agoTotally agree with you there. I worked for a telecom right out of school and they hired a couple of consultants to implement some horrible Java single sign on system (I think it was called JOSSO?) backed by our Oracle database. The system was really buggy and as we were navigating the issues with the Java code, we ended up porting most of the core functionality to Oracle Stored Procedures. Eventually, the Java code continued giving us so much trouble that I mouthed off to our VP that I could rewrite this entire system in PHP in one night. He said, "Okay, do it." So we did it...and because the core functionality was in stored procedures it was really easy to switch from Java to something else. The system never had a single issue the next 2 years that I was there after the move either. Opting to not use vendor specific features just let's you make a commitment on where you want to be locked in harder.
- combatentropy 10y agoWhen I first started out, I treated my database as just a dumb datastore. Thankfully my database was Postgres (a decision made by the team I got a job with, who obviously were much smarter than me). I think most programmers start out this way, probably because they learn a procedural language (PHP, Python, Perl) before SQL. So it's easier to write their application rules there. Regardless, even when I was using Postgres as a dumb store, I was still using it to enforce uniqueness --- which is otherwise very hard to do anywhere else. Later I started to add foreign-key constraints (I know!). Slowly I found out that other things, like eligibility checking, complex calculations, and other processing, were always much shorter in SQL than in my procedural language (which had to pull the data from the database anyway to work on it). And all other things being equal, my criterion for how to do something is, "Which way is shorter?" That's usually also the fastest to run and the easiest to maintain (though I'm not talking about using one-letter names for variables and functions --- at least not always ;). Now I'm slowly moving toward my middle language (PHP) being little more than a templating language. I think I heard that Oracle had even moved HTML formatting to the database in one of their products, but that's going a little too far.
- einhverfr 10y agoI think part of the issue is that SQL is not a programming language. You cannot really express algorithms in the normal sense in SQL. Instead you specify a result and let the db decide the algorithm. So SQL is a language you program around, not a language you program in. I.e. you can extend and consume SQL. BTW, don't move your HTML into the db :-) Separate presentation and data logic. (We are teaching a course[1] in Sweden on programming against PostgreSQL. It focuses on much of this as well as trying to look under the hood to deal with what happens when the abstraction fails to deliver what is expected.) At the end, this is a longish path and one that took me personally a long time to make. But it is something that he more we share, the better off others will be I think. [1]https://edument.se/education/categories/sql/advanced-postgresql https://edument.se/education/categories/sql/advanced-postgre...
- dozzie 10y ago> I think part of the issue is that SQL is not a programming language. You cannot really express algorithms in the normal sense in SQL. 1) You can (namely: PL/SQL). 2) The same situation as in SQL (the query part, not procedural language) you have in Prolog (though SQL query is not Turing-complete). It's a different paradigm of working with data, but it's still a programming language. > Instead you specify a result and let the db decide the algorithm. The term you're looking for is declarative programming.