Postgres Guide
postgresguide.com
postgresguide.com
Also it lacks certain information that is really helpful particularly when dealing with Postgres. An example is this: http://blog.jonanin.com/2013/11/20/postgresql-char-varchar/
The harder things that I've had trouble with are not covered. They include escaping JSON correctly when dumping the database to CSV, stored procedures, setting up a cluster, automated backups, fallover DBs and recovering from a crash with minimal downtime.
How to dump things to any file the correct way using the postgres COPY command: http://www.postgresql.org/docs/9.4/static/sql-copy.html
Stored procedures: http://www.postgresql.org/docs/9.4/static/plpgsql.html (ok, this one is a bit big... but PL/pgSQL is damn powerful)
Clustering is a topic that lives outside PostgreSQL, there are some helpful posts on the wiki though: https://wiki.postgresql.org/wiki/Replication,_Clustering,_an...
https://wiki.postgresql.org/wiki/Clustering
Failover: http://www.postgresql.org/docs/9.4/static/warm-standby-failo... ( You should really read all of this though: http://www.postgresql.org/docs/9.4/static/high-availability.... )
Recovering from a crash: This is a difficult topic. There isn't a great single page in the documentation, but essentially it just replays x-logs (from what I remember last, this may have changed), and if you lose them, there are a number of options. pg_restore from a backup, use this: http://www.postgresql.org/docs/9.2/static/runtime-config-dev.... the list is pretty long for options.
Things like being able to treat relations as types, compound types and the like. Naturally where and when these things are appropriate and when they are not would make for good subject matter not often times covered.
I don't really use this feature to drive structure (really at all), but do use it extensively when programming functions in PL/pgSQL. I also exploit this in queries sometimes as well. It's not a life changing feature to be sure, but it is relatively unique and can help solve problems that are more cumbersome to solve without the feature.
In general, PostgreSQL has no nasty surprises. It's a very smooth experience.
Even "under the hood", from a developers perspective, PostgreSQL has a very responsive mailing list, is friendly to newcomers and yet has a one of the best quality assurance mechanisms I'm aware of. Tom Lane and all the other PostgreSQL hackers do a really good job there. ("Commit fests", Releases on regular schedule, "Stable" is really stable, beta-versions are honestly marked as "Beta", etc.)
For example, take the following scenario:
1. Go to project's website
2. Click docs/documentation.
This is what you get:Postgres: http://www.postgresql.org/docs/
MongoDB: http://docs.mongodb.org/manual/
RethinkDB: http://rethinkdb.com/docs/
Wipe your entire memory of databases for a second: which one would you chose to delve further into?
EDIT: missing word
And the http://www.postgresql.org/docs/ landing page is made even less necessary since the 'interactive' documentation already has links at the top to other point versions. Throw in a minimal sidebar and you could kill the landing page without losing any of the functionality.
Of course, Postgres has been around longer, and their last major website redesign probably pre-dates the entire existence of the other two websites altogether[1], but that has no bearing on which website is the least intimidating to newcomers. If postgres sees fit to make their website less intimidating to newcomers, then their work is cut out for them.
[1] Confirmed via Internet Archive's Wayback Machine. The last postgresql.org redisign was complete by early 2006. Mongo and ReThink websites showed up, in minimal form, in late 2008 and early 2009 respectively.
Yeah, that'd be it. Not everyone comes to Postgres with an understanding of another RDBMS or even SQL; I would imagine this guide is designed to reduce the learning curve for those developers who are more likely to pick up a popular NoSQL solution simply because it has more user friendly docs and a data structure they are already used to dealing with, i.e JSON (k:v).
HN users seem to agree with the concept "if in doubt, use Postgres" but that is far from the reality out there, especially in those circles not particularly used to handling ops (e.g frontend).
I'm much happier with it now, and it's a way more robust system – but it was a hurdle to get over.
Other than that I found it a dream to work with straight away (though I have plenty of prior RDBMS experience to draw on).
e.g., If you are used to do X this way with MySQL, here's how to do it in Postgres.
I've been collecting links from this thread for my own personal learning so thought I'd throw in the only one I came here with.
So, what makes this different from that approach?
The "Filtering Data" example at the very bottom of this page [1] could be improved a bit. It's using >= AND <= for finding records between certain dates when BETWEEN is generally better for this. Since the guide is aimed at "beginners and experienced users", maybe a different example could be used or the BETWEEN version could be added below it as an example of cases where there's a more efficient way to filter data?
[1] http://www.postgresguide.com/sql/select.html#filtering-data
BETWEEN does
a >= x AND a <= y
Usually, you want a >= x AND a < y
http://www.postgresql.org/docs/9.3/static/functions-comparis...Edit: my parent post is wrong, the guide is using <, not <=, but I can't edit it now.
If you want a super scalable eventually consistent database, use one of the more minimally structured global key value store type DBs like Cassandra. In this case you do not want SQL's guarantees or structure, so don't go there.
If you want a structured database with ACID guarantees, just use XXXXing SQL.
NoSql databases that have attempted to implement structured data, consistency guarantees, rules, ACID or near-ACID semantics, etc., have all started to basically just converge with SQL. They end up re-implementing SQL but with a less consistent, hackier query language and they miss spots. They've gone around the circle and re-invented the wheel and in many cases ended up with an inferior one to boot.
Sure SQL is old. So is math. SQL is rooted in set theory and other pieces of immortal mathematical truth. It's a great example of a software system designed around ageless mathematical concepts that will always be valid. It could use some syntactic modernization, but the core of it will be as useful in a million years as it is today. Learn how to properly structure a database (normalization, DRY, etc.) and how to use its more obscure abilities (esoteric joins) and you'll find that it's amazingly powerful.
PostgreSQL is fantastic because it's doing just that: a bit of modernization around a solid core. It gives you SQL when you want structured data, and it also give you JSON columns when you want to store blobs of unstructured data in the database. So it kind of gives you the best of both worlds: SQL plus a JSON document store. You can (to some extent) query your JSON columns too, though if you intend to do this a lot I'd recommend moving that data into SQL-land.
This facilitates a kind of iterated development where you throw temporary and less structured data into JSON columns, then if you discover later that this data wants to be more long-lived and structured you migrate it to real SQL columns. It's a very agile/YAGNI way of doing things -- do it quick at first, then optimize and clean up once you know what wants to live where and what's really important.
I'm sure it needs more love and more content, but this is definitely a great start.
PostgreSQL's documentation is outstanding, but at 3004 pages (9.4's full documentation PDF) is no piece of cake. This guide serves as a starting point for people wanting to get into PostgreSQL.
Thanks!
http://www.postgresql.org/docs/9.4/static/tutorial.html
The tutorial has the additional advantage that it links directly to more advanced chapters in the manual for people willing/needing to go deeper.
It's also kept up to date by the people working on the database itself, so it's bound to be more accurate as time progresses.
I see why the performance section might not cover everything under the sun, but given how little it currently covers, I think that a link to some of the classic tuning resources would be very helpful. At the very least, mention that there are entire topics of Postgres performance that are not covered: For instance, per-table statistics targets, or tuning the database configuration to matches the available hardware and database size: If a DB has a lot of memory and is backed by an array of SSDs, the optimum settings will vary wildly from those of a small machine with a hard drive using platters (or, as some "interesting" people have done, hosting the actual database files in a network file system. shudder)
Window functions are part of the SQL standard, and certainly not unique to Postgres. I don't have time to research the implementation history across major relational databases, but they've been available in MS SQL Server since 2008 at the latest, and I know they're present in Oracle as well. It would make sense to include these under 'General SQL'.
Edit: Just noticed that this section is under both headings, nearly identically (some links are different). I didn't notice this before.
Great job otherwise!
As for the section on joins, it's definitely not well labeled, perhaps I'll churn out a page on joins tonight :)
Concise, clear and everything is in one place, that's what I was looking for. Also I can use it as a reference guide.