High Performance PostgreSQL for Rails (PragProg)

Build fast, scalable PostgreSQL and Rails apps. Solve data growth, quality, and reliability challenges, for workloads from consumer Internet to enterprise SaaS.

aapsql-500

Andrew Atkinson @andatki

edited by Don N. Hagist @dhagist

Build faster, more reliable Rails apps by taking the best advanced PostgreSQL and Active Record capabilities, and using them to solve your application scale and growth challenges. Gain the skills needed to comfortably work with multi-terabyte databases, and with complex Active Record, SQL, and specialized Indexes. Develop your skills with PostgreSQL on your laptop, then take them into production, while keeping everything in sync. Make slow queries fast, perform any schema or data migration without errors, use scaling techniques like read/write splitting, partitioning, and sharding, to meet demanding workload requirements from Internet scale consumer apps to enterprise SaaS.

Deepen your firsthand knowledge of high-scale PostgreSQL databases and Ruby on Rails applications with dozens of practical and hands-on exercises. Unlock the mysteries surrounding complex Active Record. Make any schema or data migration change confidently, without downtime. Grow your experience with modern and exclusive PostgreSQL features like SQL Merge, Returning, and Exclusion constraints. Put advanced capabilities like Full Text Search and Publish Subscribe mechanisms built-in to PostgreSQL to work in your Rails apps. Improve the quality of the data in your database, using the advanced and extensible system of types and constraints to reduce and eliminate application bugs. Tackle complex topics like how to improve query performance using specialized Indexes. Discover how to effectively use built-in database functions and write your own, administer replication, and make the most of Partitioning and Foreign Data Wrappers. Use more than 40 well-supported open source tools to extend and enhance PostgreSQL and Ruby on Rails. Gain invaluable insights into database administration by conducting advanced optimizations—including high impact database maintenance—all while solving real-world operational challenges.

Take your new skills into production today and then take your PostgreSQL and Rails applications to a whole new level of reliability and performance.


Andrew Atkinson has worked as a Software Engineer with Ruby on Rails and PostgreSQL for more than a decade. At Microsoft, Groupon, and various startups, he’s built, mentored, and influenced teams, and operated and scaled systems, improving their quality and reliability. He’s presented on PostgreSQL and Ruby on Rails at conferences, appeared on podcasts, and has written for the official Ruby on Rails weblog, with the goal of helping developers solve their challenges using these powerful open source technologies.


Don’t forget you can get 35% off with your Devtalk discount! Just use the coupon code “devtalk.com" at checkout :+1:

6 Likes

It looks quite attractive to me.

2 Likes

Just got mine!

2 Likes

Thanks @adamaiken89 and @gersoncjunior. Have you had a chance to read some of the book? If so, I hope you’ve liked it, and would consider leaving ratings or reviews describing your perspectives.

We’re approaching the final version, going into print soon. Very exciting!

1 Like

@andatki

I bought the book yesterday and only briefly skimmed the partitioning section so far, and I’m a bit disappointed that it’s not mentioning the Rails 7.1 query_constraints at all, which is one of the last missing pieces to make partitioning work almost painless in Rails. I was hoping that since the book is on version 7.1 it’d at least mention them as a way to have tenant-based partitioning possible.

2 Likes

Hi @Joe-Degler Thank you for the feedback. I’d say you’re in a more limited set of readers that know how to leverage table partitioning, plus how to integrate it well with Active Record. The main purpose of that chapter was more for exposure to what table partitioning is, how to use it, and some basics on integrating it with a somewhat realistic scenario for a high growth table in Rideshare.

My feeling at the time of writing was that table partitioning was historically a “DBA thing” and not really known by generalist backend engineers, why to use it, how to perform the data migration, and what the caveats are. I could be wrong, but that was based on the types of Rails projects and teams I’ve been part of I guess, where table partitioning was almost never used.

By query_constraints here, are you talking about describing the foreign key columns? If so, did you know that in Active Record 7.2 they’re changing that to foreign_keys? I only learned about that recently while writing the post below. There’s a PR linked from rails with more context. I’d love it for you to check this out and hear your thoughts on that.

My table partitioning and Rails app experience in the real world was when working on a Rails app that was running an earlier version than 7.x. I didn’t know about query_constraints as an option when writing that chapter, and thinking about it now, I guess it was a missed opportunity in technical review feedback too, to include that information.

Now that you’ve pointed it out though, I’d love for us to be able to get some kind of addendum together. At a minimum, maybe a blog post or something else. Would you be interested in writing up a blog post? You could explain that you noticed that important part missing, what it is, why it’s useful, and provide some recommendations. I’d happily credit your post, list your name, etc. However, if that isn’t something you’re able to do, I’ll file this into a list of future items to study and write up, for possible future blog posts on my own blog, and/or possibly as new sections or content to include in future versions of the book.

Thank you for the feedback!

1 Like

I could be wrong, but that was based on the types of Rails projects and teams I’ve been part of I guess, where table partitioning was almost never used.

I’m inclined to agree, although I think if the description of the book describes “using them to solve your application scale and growth challenges.” I’d have expected it to be included as well.

Right now I’m about 50% through with the book, and my general takeaway so far is that, while I personally skimmed a lot of it because I already knew it, this is a book I’d have greatly enjoyed a couple years ago when I was still more green behind the ears. I appreciate that you take the time to explain even minor concepts instead of handwaving them away. Although I definitely am taking notes of gems or failsafes you’re recommending and cross-checking them with our prod setup to look for improvements.

By query_constraints here, are you talking about describing the foreign key columns? If so, did you know that in Active Record 7.2 they’re changing that to foreign_keys ?

That’s right, and I am aware! It’s a current project that we migrate our home-grown partitioning solution to rails-native. That was the USP for the book for me, though it’s not the end of the world.

Now that you’ve pointed it out though, I’d love for us to be able to get some kind of addendum together. At a minimum, maybe a blog post or something else. Would you be interested in writing up a blog post?

I’d actually be interested, albeit I’m lacking the time. If I have some capacity, I’ll let you know in advance - otherwise you’re free to tackle the project yourself if you do an revised edition.

2 Likes

Can you do proper DDD/CQRS/EventSourcing in Ruby on Rails?

1 Like