SPACE. ROCKETS. PostgreSQL.
Learn PostgreSQL the way the pros do: on the job and under pressure. You'll assume the role of interim DBA at aerospace startup Red:4, exploring data from the Cassini mission!Buy Now
YOU'VE FOUND YOURSELF IN CHARGE OF A POSTGRESQL DATABASE full of data from space... WHAT NOW?
Data is a powerful drug - it's the life blood of your business. How do you ensure that it's correct and tells the right story?
Starting an application is simple enough but a year from now, when your app has grown and you're trying to measure what's happened - that's when you're going to find out how well you took care of your data.
PostgreSQL is there to enable, enhance and extend what you do as a developer/DBA. And just like any tool in your toolbox, it can help you create crap or it can make you a superstar.
That's the perspective of A Curious Moon - data is the truth, data is your friend, data is your business. The tools you use (namely PostgreSQL) are simply there to safeguard your treasure and help you understand what it's telling you.
You'll step into the shoes of Dee Yan, our fictional intern at Red:4 Aerospace. She's just been handed the keys to a massive set of data, straight from Saturn, and she has to load it up, evaluate it and then analyze it for a critical project. She knows that PostgreSQL exists... but that's about it.
Much more than a tutorial, this book has a narrative element to it a bit like The Martian, where you get to know Dee and the problems she faces as a new developer/DBA... and how she solves them.
A CURIOUS MOON: EXPLORING CASSINI'S DATA WITH POSTGRESQL
Follow along with Dee Yan, our fictional data science intern, as she assumes the job of interim database administrator at the fictional aerospace startup, Red:4. She’ll learn PostgreSQL like we all do: on the job and under pressure.
You’ll start out with the basics: creating tables and importing data. Soon, however, you’ll be awash in glorious SQL and data from space (the NASA/JPL archives of the Cassini mission), creating functions, common table expressions and calculating aggregates using window functions all in the name of science while trying to figure out if there’s life under the ice of a very curious little moon.
A Treasure Trove
I’ve found the book to be a treasure trove of Postgres features. CTEs are blowing my mind right now. I’m a backend engineer, and I’ve been sharing what I’ve learned with my coworker who is a DBA. She is picking up some tips through me now! I haven’t found a good, engaging tutorial for these intermediate/advanced Postgres tricks, and "A Curious Moon" fills this gap. As a bonus, I’m also picking up some bash tips from the book.Loren Stewart Programmer
YOU'LL DIG IN TO SOME OF THE MOST AMAZING DATA OF OUR LIFETIME...
I won't waste your time with sleep-inducing demos and examples - we're going to hit the ground running by importing millions of records into PostgreSQL right from the command line and then we're going to interrogate it for correctness. From there we put our detective hats on and get to work.
Learn the CLI
We don't have time for fluffy tooling! Yes there are GUIs and visual tools out there, but SQL with PostgreSQL is simple and easy to use when describing the precise table and index set that you want.
Data Import from CSVs
You'll import data like a pro, using the command line and a Makefile. There are GUIs you could use, but here at Red:4 we believe in keeping things simple and powerful.
Cleaning Crap Data
You will become "data minded". You'll go through a basic audit process from real, raw data from JPL. It doesn't matter where the data is from, it will always have errors.
You'll sleuth through raw Cassini data using basic queries. Pulling data in is only part of the process – looking for clues and understanding what you're seeing is the next step. To do this you'll use Common Table Expressions, Full Text Search indexing and Windowing Functions.
You'll speed up slow queries with built-in analysis tools and objects. The Cassini data dump is gigantic, and sifting through the analysis records can be time consuming! You'll use EXPLAIN and ANALYZE to figure out where to put your indexes and when it makes sense to build a materialized view, which is data cached on disk.
NASA is a very thorough organization, but it's staffed by humans and humans like spreadsheets and spreadsheets destroy data. You'll use mathematical analysis to verify flyby altitudes and speeds using data from the INMS during the 22 close encounters with Enceladus.
YOU'LL RUN QUERIES LOOKING FOR THE PRESENCE OF LIFE UNDER THIS
You'll finally perform the ultimate analysis on very real scientific data: Is There Life Under the Ice of Enceladus? You will have all the data you need to support this claim: thermal, chemical and mineralogical results from two of the most sensitive instruments humans have ever created. You'll run the query and see the results for yourself!
WORKING WITH DATA CAN BE THE MOST Exciting Job you've ever had.
It's a discovery that most DBAs don't want "app devs" to know: working with data is intoxicating. Learning the skills you need to effectively work with data can be one of the best investements in your career... just ask these people...
Compulsively readable. Recommended.
Reading through A Curious Moon... It's like reading The Martian, only instead of trying to survive in the hostile environment of another planet, it's about trying to survive in the hostile environment of snarky DBAs. Compulsively readable. Recommended.
I am loving the book!.
I am loving the book! The narrative format is like no other programming book I've ever read, and it's really keeping me engaged and interested. I've struggled in the past to keep pushing through programming books that are dry & stock standard, but the characters in A Curious Moon make the book relatable and it makes me want to learn.
One of the best technical books I've ever read.
I really am enjoying this book! It is one of the best technical books I've ever read, and I read more than 40 books per year (technical and non-technical). What I like most about this book is that you mixed a sci-fi story with technical writing. It is like a novel for geeks!
WAIT ARE YOU SERIOUS? ENCELADUS? POSSIBLE LIFE UNDER ITS ICY SHELL?
Yes, absolutely. Back in 2005 Cassini did a routine flyby of Enceladus, a moon that's about the size of Great Britain (313 mi in diameter). It's the most reflective body in the solar system, covered with smooth ice... except for its south pole...
The Great Cosmic Mystery
Turns out this little moon gets squeezed between Saturn and Titan and the gravitational pull grinds out some heat within its core. Heat that produces temperatures up 90 C in some spots, which look suspiciously like the deep water plumes we see here on Earth. Oh, but it gets weirder...
That heated water produces plumes at the moon's south pole which jet material into space. We didn't know what was in that material until 2007, when Cassini flew right through them at ridiculously high speeds and low elevation.
The onboard mass spectrometers scooped it up and... wouldn't ya know... it's sea water. There's a salty ocean under the ice and it containes methane and hydrocarbons that mirror the deep sea "chimneys" that we have here on Earth. This has led scientists to speculate that Enceladus is a bioreactor, capable of producing life in extraordinary circumstances.
This little moon is quite small, about the size of Texas, yet it jets water out continuously into space. Some of it rains back down as fine ice particles, covering the surface and making it the most reflective body in the solar system. Some of it gets sucked back into Saturn itself, making Enceladus the only moon we know of that contributes matter back to its host planet.
And some of it goes into orbit, creating the "E ring" of Saturn which you see above. That ghostly blue glow, the second largest planetary ring in the solar system, was created entirely from the icy jets of Enceladus... which is way too small to contribute that much material.
What the hell is going on up there?
I don't know... you tell me. We can speculate all day about aliens, sunken UFOs and Thor's hidden palace but you know what would be even better? Letting the data tell us what's going on.
That's what we do as data people: let the data tell us the story. It's all in there, and with Cassini's mission data we have a gigantic amount that we get to sift through for answers.
That you get to sift through. Buckle up! PostgreSQL is fun and all, but it's the data behind this story that's the fun part. When you're done with this story, you'll be able to run (and understand) one hell of an amazing database query. These results were dubbed a "smoking gun for life in the waters of Enceladus" by NASA itself.
THE MOST FUN YOU'LL HAVE LEARNING about data and databases!
Frequently Asked Questions
Will I get every update?
Yes. I will never create a "new edition" that you'll have to pay for. That said, this is only for the digital edition. The print version is sold by a different store (Blurb) and I don't have acces to that.
WHAT IF I FIND A PROBLEM?
You very well might! It's been a few years and I've worked a lot of things out, but if you find an issue, there's a link in the front of the book where you can log an issue.
Are the books and videos DRM protected?
No, I hate that. I do ask that you not share, however, this book took me a long time to write.
Is this a print or digital book?
It's digital and there are no plans to print it just yet... though maybe someday. You can download PDF, epub (iPad/iOS) or Kindle versions.
Will this work on my Kindle [X]
Yes, it should. The problem is that Kindle's have a proprietary format and it's kind of guesswork as to how to get it to layout properly. I've tried a zillion methods and the recent one as of 2019 seems to work for most Kindles.
IS THIS FOR REAL? YOU MUST HAVE MADE SOME OF THIS UP?
Not one bit - all of it (the data and the story) comes from NASA/JPL. I did make up the main character, Dee Yan, as an amalgam of good friends of mine but all of the data is 100% straight from Cassini.
HOW CAN I GET THE DATA TO PLAY ALONG?
There are links in the book that direct you to a ZIP file you can download. It's full of amazing CSV data including the "Master Plan" mission data that outlines every command sent to Cassini.