> I am completely blown away by how amazing this is and how dramatically it impacted performance. Creating a simple index dropped database queries from ~8s to ~20ms on a production DB which containing around 20mil rows.
PostgreSQL index only scans FTW.
Now in Beta: High Performance PostgreSQL for Rails by Andrew Atkinson
Build faster, more reliable Rails apps with scalable and reliable PostgreSQL databases.
Join the beta. Be part of the book!
Early career Ruby programmer: add all the gems. 1000 line PRs. Full stack, full kitchen sink.
Later career: remove code, remove gems, small as possible PRs, update docs, prefer removals, iteratively deliver PRs back to front. Prefer no code. Recycle, reduce, re-use.♻️
🗣️ Hey folks: I've launched independent consulting!
💎🐘📈 I’m offering Ruby on Rails development services, focused on increasing the performance, scale, and reliability of PostgreSQL database operations.
📅 Please check out and share my consulting page!
“How we migrated our PostgreSQL database with 11 seconds downtime”
AWS DMS, Route 53 w/ a 1 second DNS TTL, version 11 to 15, 400GB size. Lots of nice details on timings, prep work, disconnecting clients. HN:
PostgreSQL features are important enough to Active Record and Ruby on Rails that a dedicated Rails Guides page was created.
Features like exclusion constraints, that don’t exist in MySQL or SQLite, are included.
Learn more:
For a slow PostgreSQL query, filtering 18 mo range on 5+mm row table, left joins to 2 more 5+mm row tables, started at 2s: created a new design that runs in 25ms.
Involved multiple materialized views, unique index for concurrent refreshes, union, and targeted covering indexes.
Happy Friday. Do you use PostgreSQL 🐘 or Rails,💎 or want to be an early supporter?
📢 Big Announcement! I’m writing a book called “High Performance PostgreSQL for Rails” that’s now in technical review. Subscribe below for early access. Thanks! 😊
Hey Rails +
#PostgreSQL
devs, what's one
#PostgreSQL
thing you wish you knew more about, that's not covered deeply (or at all) in the Rails Guides? Thanks!
🎉 I’m excited to teach Rails developers how to "Build High Performance Active Record Apps" this May at
@railsconf
!
Attendees will learn how to write high performance queries with supportive indexes, and configure Active Record Multiple Databases. I'd love to see you there! 😊
“It's not Ruby that's slow, it's your database”
Post by Bèr Kessels. Good stuff. Understand the queries. Keep them simple. Avoid footguns and strive to minimize all query components, to maximize reliability and scalability.
"High Performance PostgreSQL for Rails" is selling & shipping on Amazon. It's currently
#2
in Best Sellers in the Ruby Programming category! This algorithmically-generated list of books is a bit sketchy though.
We're coming for you... "150 Most Famous Poems!" 😂
@pragprog
Feeling incredibly fortunate to have the
#1
best selling book in the "Ruby Programming" on Amazon (ok, technically there's the "150 poems" book 😂), and the overall
#1
best selling book for nearly 6 weeks on
@pragprog
.
Thank you so much to the readers and supporters!
Whoa. Studied PostgreSQL query plan. Times jumped on a Merge join. Source CTE query had no explicit ORDER BY.
Added ORDER BY PK ASC. Time dropped from 110ms to 4ms w/ that.
Overall: Started at 800ms. Added indexes and optimizations. Ended w/ all Index Only Scans and sub 5ms! 🔥
It's done! Just sent the email to the editor to make it "official."
✍️📖🛑🐿️➡️🎅
Next week I'll be crafting my reflections and individual thank you messages to those who helped over the last 20 months. Feeling deeply grateful and excited about 2024.
Needed a screen time break, but found a lengthy post to read. What to do? Inspired by
@aarondfrancis
, I used a “printer” to make a physical copy. The year 2000 called and wants their 16 pages back, but they can’t have ‘em.
☀️ Grabbing a pen, cool beverage, and heading…outside!
Besides the benefits of PostgreSQL docs read by a super smart, experienced engineer, a really fun thing about this
@hnasr
video is experiencing the "joy of learning" secondhand. "Interesting! I didn't know that." 😊
All Postgres Locks Explained 👉
Posted on Reddit /r/rails over the weekend and got a lot of great responses! It was validating and energizing to see the enthusiasm. Responded to commenters and picked up a lot of new subscribers for the book newsletter.
#pgrailsbook
#PostgreSQL
To build hype for the upcoming Beta release of , I'm offering a sneak peek at content exclusively to subscribers. Over the next month 1 email/week will summarize 10 unique gems and extensions from 40+ in the book. Sign up today! First email tomorrow!
📚 "High Performance PostgreSQL for Rails" back on top of the weekly bestseller list
@pragprog
!
Thanks so much! Visit the forum for feedback, and please add ratings and reviews on Goodreads.
❓
🗳️
Winding down a big batch of PostgreSQL client DB index optimization. Removed 175 unused indexes. Added 25 new ones. 775GB DB and 250GB indexes. Some dramatic reductions of scan costs, opening up query perf improvements and greater scalability and reliability.
Excited to see well-known open source Ruby programmer and pgvector PostgreSQL guru
@andrewkane
has ordered a copy of
#pgrailsbook
!
Several of Andrew's high-quality, useful, and category-leading libraries in Ruby and Postgres—are featured in the book. Thank you Andrew!
Hello. 👋 I’ve got a newsletter for my PostgreSQL 🐘 and Rails book. I’m preparing the next issue now, which features my experience on final revisions, current promo codes, ratings and reviews, and related PostgreSQL content. Sign up to get it 👉
This is it! 😄Today is the last day before the Beta book release. Subscribe today to get the final pre-Beta newsletter email. Pre-Beta release subscribers will get an exclusive discount code after the book launches. Thanks!
#pgrailsbook
Want to build snappy Rails backend apps that users love, w/ sub-5ms DB queries? Reach global scale w/o re-architecting or cache stores. These skills aren’t magic. Come to my workshop “High Performance Active Record Apps” at
@railsconf
to demystify & learn w/ hands-on exercises.
“If you use Rails and Postgres, this book is required reading.
If you use Postgres and a different framework, you will still get a ton of value out of it. Every section goes deep.”
Thank you
@jpcamara
! 🙌
#postgresql
#rubyonrails
@pragprog
📅 Mark your calendars! Next Tues. June 11, 11:00 AM PDT / 1PM CT.
@PosetteConf
is a free online conf.
We'll cover basics of multitenancy and related PostgreSQL DB tech: row level security, table partitioning, Active Record Horizontal Sharding and Citus.
“PostgreSQL’s optimizer has dropped tail latency by nearly half in the last 10 years!”
And that’s software running on greatly improved hardware: faster storage, memory, and more CPU cores! 💨🍃
#1
bestseller this week at
@pragprog
🎉😊Thank you so much to readers for your support, encouragement, and suggestions. Still working hard on simplifying and clarifying the words and examples. Keep the feedback coming. 🙌
Best Sellers
High Performance PostgreSQL for Rails: Andrew Atkinson
Programming Phoenix LiveView: Bruce Tate Sophie DeBenedetto
Machine Learning in Elixir: Sean Moriarity
Programming Ruby 3.2 5ed: Noel Rappin
Business Success w/ Open Source: VM Brasseur
💎 🐘 Code “RailsConf2024PG” at checkout takes 40% off the ebook for a few days following
@railsconf
.
The book is just about fully out of Beta, into print. Print pre-orders from Amazon etc. are available:
Thx!
@pragprog
Hello
#RailsWorld
and
@pgconfnyc
! Use PostgreSQL and/or Rails? Traveling and need podcasts to listen to? I've been hitting the circuit. Episodes linked below. Please repost/share! Then I'd love for you to check out “High Performance PostgreSQL for Rails” (
@pragprog
) now in Beta👇
📰 With Postgres shops
@supabase
@neondatabase
and
@crunchydata
(re-)announcing their General Availability, I wanted to get in on the action.
ICYMI, I’m Generally Available for PostgreSQL consulting. 😂 Hit me up if you need some help. 👉
Amazing. Checked the numbers this morning — 50 copies sold while I was sleeping. 🤯 Back in the
#1
slot on the publisher Best Sellers list. What an honor and privilege!
@pragprog
Just updated! Check out Chapter 10 “Handling Greater Concurrency” of
#pgrailsbook
, where you’ll configure PgBouncer version 1.21.0 to use Prepared Statements and the `statement` pooling mode, connected to PostgreSQL.
MSP ✈️ LAS for
#SinCityRuby
2024 to present “Mastering Query Performance” w/ PostgreSQL & Active Record. Attendees will learn fundamentals of well-designed indexes. With a query on tables w/ 10s of millions of rows, we’ll reduce the exec time by 99% to sub-5ms. Excited to share!
is what we recommend in High Performance PostgreSQL for Rails as well.
Check the book app repo and the "Development Guides" repo for instructions and config on and lots more.
makes upgrading Postgres and managing multiple versions a breeze on mac. So much easier than on the CLI with homebrew! The work to upgrade was:
1. Check for updates > Install
2. Create New Server (Postgres 15)
3. Profit!
🐘 Need some help with PostgreSQL performance or operational challenges? How about booking a session with me? I've got immediate availability to help you out.
👉 Learn more about Coaching and Advisory sessions here:
Thrilled to see [in Beta] "High Performance PostgreSQL for Rails" at the top of The Pragmatic Programmers bestseller list for another week! 🙌 Thank you so much to the supporters, fans, friends, and readers that are making this possible!
#pgrailsbook
Best Sellers
High Performance PostgreSQL for Rails: Andrew Atkinson
Programming Phoenix LiveView: Bruce A. Tate and Sophie DeBenedetto
JavaScript Brain Teasers: Faraz Kelhini
Machine Learning in Elixir: Sean Moriarity
Hands-on Rust: Herbert Wolverson
This looks nice. An APM style tool with easy configuration isn’t something
@rails
supports. Has someone built on ActiveSupport::Notifications or log parsing? Any recommendations?
The Laravel team continues to push the scope of what a "framework" can be. They just dropped another first-party, free offering that could be a million-dollar SaaS.
Pulse is basically a full-on, self-hosted APM tool.
🐘 I’m leading a two hour workshop on Active Record and PostgreSQL database topics at
@railsconf
next week, where dozens or possibly hundreds will attend.
⚡ This is an amazing opportunity to contribute to the technical and professional growth of other Rails developers!
For anyone that missed over holiday break: High Performance PostgreSQL for Rails was the
#3
overall best seller for
@pragprog
in 2023. 🎉 Not bad since sales started ~ Sep. 1! Discount code "2023Top10" still good for 40% off!
Great to see
#pgrailsbook
at the
#3
sales spot for 2023! The Beta launched around September 1st. We’re excited for the book to go to print and to see what happens with a full year of sales!
🇪🇸 Continuing to send signed book copies to VIPs. This person needs no introduction in the Rails community.
@fxn
helped on editing and consistency with Rails content early in the book content, for which I am very grateful. Gràcies Xavier!
Very fun to show off the
#PostgreSQL
query planner and indexing capabilities at
#SinCityRuby
. Some folks didn’t know about Covering indexes, benefits of sorted data, viewing buffers/pages accessed, or how extensible PostgreSQL is and the hundreds of available extensions.
Good Job shout out. Background jobs w/ PostgreSQL and Rails.
@bensheldon
You’ll find Good Job featured in “Chapter 15. Advanced Usage and What’s Next”
#pgrailsbook
Configuration w/ sample app, exploring PostgreSQL impl details. Curious about Solid Queue.
🎧 "Just use Postgres with Craig Kerstiens"
@SoftwareHuddle
Craig is discussing learning Postgres w/ books, and mentions first
@TheArtOPostgres
then...my book! (21:40) "It's a great, great book!" What a nice surprise, thanks
@craigkerstiens
! cc
@pragprog
What
@dhh
is saying about
@rails
here can be said about another amazing open source project: PostgreSQL. Any dev can download it, use it, compile it, fork it, or build a commercial business on top. No impediments to start. No single entity in control.
The
@honeypotio
Rails documentary Q&A with
@dhh
@jamis
@tobi
&
@bitsweat
is now online. They covered a lot of ground, covering the start of Rails, the state of open source, and so much more. Thank you Elise Shaffer
@therubyonrails
for moderating! 👉
Nice detail from the great post "100x Faster Query in Aurora Postgres with a lower random_page_cost" from
@shayonj
. Shayon shows how to de-risk the config change by setting it for a single session in a Ruby block that calls RESET at the end. Good idea!
💻 As a Rails developer I use “rails console” daily for code, but I don’t use a CLI client like psql to work w/ SQL. Should I?
What are the benefits and basic commands? Come to my workshop “High Performance Active Record Apps” at
@railsconf
to learn more, w/ hands-on exercises.
⭐ I'm seeing stars! My small Rails API-only app:
☑️ Became the Rails + PostgreSQL app for my book
☑️ Has been used for examples in my presentations and workshops
☑️ Recently gained 100 stars!
Just wrapped up a live, two-part training on PostgreSQL topics for Rails engineers, running big DBs. We discussed Transactions, MVCC, Query Planning, Indexes, Bloat, Locks, and Partitioning.
If your team would benefit from this, please get in touch!
So cool to have been a guest on ! I’ve been a listener since the first episode in August 2022, and have caught every episode since due to the high quality content! Thanks for the opportunity
@michael
and
@samokhvalov
!
New episode: "Rails + Postgres"
Michael and Nikolay are joined by
@andatki
, author of High Performance PostgreSQL for Rails, to discuss things like where the limits are, how people use the ORM, and things we can improve!
🎧
📺
With Redis changing the license, maybe you’d consider migrating that data to PostgreSQL? While less commonly picked for cache data, session ids, and transient background job data, PostgreSQL is capable.
DIY (Chp 15):
Or hire me:
Back-to-back PostgreSQL-themed
@remote_ruby
episodes! Woo! 🐘
👉 Follow Craig
@craigkerstiens
And thanks for the shout out
@jmcharnes
! You’ve got the right idea to make DBs less scary: learning and hands-on practice.
Great to meet
@shayonj
over Zoom for the first time, who's hacking on amazing open source PostgreSQL management tools, written as command-line Ruby programs. Online schema changes 👉 and zero downtime upgrades 👉
Great work!
Brian of wrote an amazing
#PostgreSQL
technical blog post called "Cost of a Join" that creates a reproducible set of evidence showing the incremental performance impact of JOINs. Brian refutes common wisdom that denormalization is better than a join.
Learn about creating and updating Materialized Views using the Scenic gem with Ruby on Rails and Active Record. Add Unique indexes to them to refresh their results concurrently.
#pgrailsbook
#postgresql
#rails
PR:
Book:
This extension could be a game changer for more efficiently generating, indexing, and retrieving UUIDs. Crunchy Bridge already supports it!
#PostgreSQL
💐 While I’m experiencing professional life “highs” recently, today came with a personal life low. I’ve just returned from a beautiful celebration of the life of my friend Katie, a wife, mom, and supremely caring person, serving the community as a dentist, gone way too soon.
When adding an index to a table, how do know it’s used, and how much an improvement it makes? What about the bytes saved vs. bytes added for writes? Come to my workshop “High Performance Active Record Apps” at
@railsconf
where we’ll learn about this topic w/ hands-on exercises.
Thanks so much for the likes, reposts, and purchases, helping announce the print availability of “High Performance PostgreSQL for Rails.”
Currently on top of the
@pragprog
weekly bestseller list! 🎉
Hey
#Rails
devs: if you heard of Unlogged tables in PostgreSQL for the first, you might be wondering what they are. This post briefly shows how to use unlogged tables and the RETURNING keyword for higher performance bulk inserts.
#PostgreSQL
Great lightning talk demo of "pgmq" by
@adamhendel
Showed how to enqueue jobs, process them, and hide them! (optionally keeping hidden jobs around for analysis). Nice!
@tembo_io
@pgconfnyc
Active Record Multiple Databases Tips: For read replicas, to avoid running migrations and to skip “database tasks” like seeds, use the options “replica: true” and “database_tasks: false” respectively in config/database.yml.
#pgrailsbook
@rails
I've just added a YouTube recording link to my slides "How We Made PostgreSQL Fitter, Happier, More Productive" from PGConf NYC 2021, using the new "Resources" section of
@speakerdeck
.
👀 Check it out!
> “We picked Postgres as our foundational database. We built tenant virtualization into it, allowing many virtual tenant databases to be placed on physical Postgres databases.” This is big.
Congrats on the launch! (cc
@gwenshap
)
🚀I am excited to reveal Nile to the world finally!
Nile is serverless Postgres database for modern SaaS
Nile virtualizes tenants into the database to provide
1. Tenant isolation and per-tenant backups
2. Drop-in organization and user management
3.
Very grateful to the Technical Reviewers and their feedback for "High Performance PostgreSQL for Rails." Made it through Chapter 1. 😅 Excited to apply the corrective feedback and incorporate their suggestions!
#PostgreSQL
#PGRailsBook
Black Friday sales were even more amazing! More than 100 copies sold in a day! Motivates us to work even harder on Beta reader feedback. Feels special to work on a book so many programmers find useful. 😊 turkeysale2023 40% off code still active!
@pragprog
Amazing. Checked the numbers this morning — 50 copies sold while I was sleeping. 🤯 Back in the
#1
slot on the publisher Best Sellers list. What an honor and privilege!
@pragprog
Met
@tobias_petry
over Zoom, author of the amazing and multiple books! We discussed writing, promotion, marketing, sales, consulting, DBA vs. developer audiences, query plans in PostgreSQL vs. MySQL, and more. Looking forward to another chat!
#databases
✂️ I wrote about SPLIT PARTITION and MERGE PARTITIONS commands, coming in PostgreSQL 17, 🐘 imagining use cases and showing the DDL needed to try these at home. 🏠 Let me know what you think!
#PostgreSQL
@nori_shinoda
@jer_s
@CrestonJamison
ICYMI over the weekend,
@railsconf
posted a nice presenter intro. Thank you!
💻 Big week for workshop prep! In-person local version happening tomorrow in Mpls w/ 15 participants.
🎙️ Soon: new podcast ep. dropping w/ workshop preview. 🤫 Stay tuned!
Meet
#speaker
@andatki
, Staff Software Engineer, Independent Consultant and Author 👨🏻💻✨
Andrew is the author of High Performance PostgreSQL for Rails. He's spoken at Sin City Ruby, RailsConf, PGConf NYC, PGDay Chicago, and RubyConf Argentina.
Learn more:
Had a great time meeting Charles (
@cmaxw
), Valentino (
@thecodenamev
), and Dave (
@kobaltz
) at Ruby Rogues! We discussed PostgreSQL with Ruby on Rails. We chatted about the writing process, and how it's aimed at "Application DBAs" (credit:
@be_haki
). 👉
Finished recording my talk for
@PosetteConf
! Swapped my normal black t-shirt for a purple one. Let's make
#Posette
#Purple
a thing! 😂
Looking forward to the live event June 11 at 11:00 AM PDT. I'll be online for the live Q&A!
@tgcmn
@clairegiordano
📼 Recording today!
“SaaS on Rails on PostgreSQL”
Attend this free online event, to be streamed with live Q&A on June 11! Hope you can attend. 😊
@PosetteConf
@rails
#PostgreSQL