4 ms·
These are great. I feel like no matter how many PG tips & tricks I learn, there's always something new out there. I recently started learning PostgreSQL after
by bmpafa 8y ago
These are great. I feel like no matter how many PG tips & tricks I learn, there's always something new out there.
I recently started learning PostgreSQL after ~2 yrs of relying on BaaS etc. (mostly of the NoSQL variety).
I have to say: I regret not learning it earlier. Stuff like constraints, triggers, views, etc., are game-changers, but even just being able to write queries instead of navigating a proprietary GUI was worth the few weeks it took to learn.
It was also a boon for data analysis work. Whereas before I'd take a few hours cleaning some data with JavaScript or Python, now I just write a SQL query or two. It's faster, it feels more powerful, and it's _substantially_ less fragile than one-off data cleaning scripts.
Anyway: for those that started out like I did, afraid of SQL, dive on in.
- cuchoi 8y agoHow did you learn? Old-fashioned trial and error + googling?
- woah 8y agoRead through the docs
- JohnCohorn 8y agoThe PG docs are surprisingly good. Good enough to learn from. I remember learning my first SQL back in like 1999 or 2000 by reading the PG docs in the back of my parents minivan. Good times!
- paulie_a 8y agoI don't mean to knock the pg docs but I honestly come away reading them with the feeling "what did I just read?". They seem dense and dry. So personally I appreciate the articles like this to help me really learn. I will skip over official documentation and go to this sort of content.
- jlg23 8y ago> They seem dense and dry. I consider that a feature. I loathe wasting my time by having to dig through layers of prose to get some fact. But they are probably not suitable as a tutorial, they only make sense when you already know relational database basics and need info on pg-specifics.
- paulie_a 8y agoIt's a personal preference I guess. I'd rather hit up stack overflow and find a common English answer to a similar problem that usually includes an example. Django suffers from the same thing... excellent docs, that just seem unapproachable day to day. Basically when I Google something, I'm skipping the first 2-3 official links that in fact contains the info I need, but instead clicking the one that summarized it more plainly
- mgkimsal 8y agoIf it doesn't actually resonate with you, and you don't come away with the understanding you need, it's most certainly not a 'feature' but a 'bug'. I think some projects see dense/thicks docs that keep a high barrier to entry as a feature itself as well. If they're not approachable, they're not 'excellent'.
- paulie_a 8y agoI've been a django developer for a decade and keep hearing from others how great their docs are. I barely ever use them. My biggest complaint is they give examples without any context. I can't look up a feature without knowing 12 other things before
- bmpafa 8y agoYup-3 parts elbow-grease, 2 parts tears & sweat. I had a lot of data to work through, so I used that as an excuse. Not having to worry about performance, schemes, servers, users, etc., made learning a lot easier, I think. I started by reading the tutorial in the PG docs[1]. It was _very_ well-written & accessible--def. recommend. Later, I picked-up the book "Mastering PostgreSQL in Application Development"[2]. It was pretty solid, and seemed one of the only books aimed at developers (as opposed to DBAs). [1] https://www.postgresql.org/docs/10/static/tutorial.html https://www.postgresql.org/docs/10/static/tutorial.html [2] https://masteringpostgresql.com/ https://masteringpostgresql.com/
- amorphid 8y agoAfter mostly relying on ORMs for years, I wanted to brush up on SQL, so I wrote this... https://github.com/amorphid/learn_sql_ruby https://github.com/amorphid/learn_sql_ruby Basically I just used the pg gem for Ruby to execute a bunch of raw SQL commands and wrote tests to check to see if the output was correct. It taught me a bunch in just a few days!
- bitexploder 8y agoORM is much easier when you know what is going on and can dove into a query plan. I have noticed most devs that struggle with ORM and or performance tend to just not understand basic RDBMS/SQL stuff. Indexes, joins, how to tell ORM to prefetch, reviewing query plans when the performance matters.
- mercer 8y agoI also recently began learning SQL properly, and I also regret not having done so earlier. The PG docs/tutorial is really great to get started. After I worked through those, I feel it was essential to work my way through pgexercises.com. It's really easy to think you get it, but actually having to puzzle through stuff is obviously quite different. When I reached some of the more complicated subquery stuff, I decided to get 'Learn SQL' by Alan Beaulieu (recommended by pgexercises), and I just worked my way from the start all over again. Book's excellent too. I do find that I hit a 'barrier' when all the basic parts are introduced and it becomes all about translating a goal to 'thinking in SQL', especially when there seem to be multiple valid approaches. But the combination of reading a ton, then doing the exercises, then re-reading and trying to play around with the Learning SQL db (Sequel Pro is great for Mac, as is Postico (Postgres)) has been very effective so far.
- mmckelvy 8y agoI found this recent book by one of the Postgres contributors helpful: https://masteringpostgresql.com/ https://masteringpostgresql.com/