HNHacker News
TopNewBestAskShowJobs

andatki

40 karma · joined August 14, 2023

andyatkinson.com
submissionscomments
andatki··on Everyday performance rules for Ruby on Rails developers
Great! I wasn’t sure whether to plug it but it seemed very relevant to the post. :)
andatki··on Everyday performance rules for Ruby on Rails developers
I tend to agree as a SQL enthusiast. However I have yet to see a Rails team that doesn’t use Active Record or writes much SQL directly, or by default, across 100s of apps. I’m sure it happens but in my experience it’s rare.

This is a place where I think tools like Rubocop help. They can be configured to point out method swaps like this (size over count) automatically which is a relatively low effort task to change the code.

With those rules/linting in place, you aren’t throwing out the benefits of AR (ORM), and hopefully leveraging their useful methods like these that help avoid unnecessary queries.

andatki··on Everyday performance rules for Ruby on Rails developers
I like how the PostgreSQL docs use the term “profitable” for whether an index helps.

The purpose of the index often is to lower the “cost” (greater profit), by providing more values the query is accessing (filtering, ordering, selecting) within the index entries, for faster retrieval.

When users have the skills to generate query plans and review whether an index supports a query, verifying that the index is picked by the planner, and indeed lowers the cost, then they can answer this question for their own unique combination of hardware, data distribution, queries, and indexes.

As generic advice, I think more often than not the index won’t be used for Boolean columns. But it’s generic advice and it does depend.

As you suggested, users must check their own system.

My book also covers the 2 and 3 value variations (nulls allowed) for Boolean columns.

For readers wanting to build these skills themselves, here’s more info:

https://news.ycombinator.com/item?id=38407585

Good nudge that it depends!

andatki··on Everyday performance rules for Ruby on Rails developers
Really solid list! I went through all the Active Record, query design, and index design tips for PostgreSQL, and can +1 them all. Nice work.

For readers who want all of these and more in book form, with a sample Rails app and big data to test with (generated), please consider my book:

High Performance PostgreSQL for Rails https://news.ycombinator.com/item?id=38407585

The book helps readers build database skills with the overall purpose of improved performance and scalability.

Again, great, concise article. I’ll be recommending it to others and it will help a lot of developers!

Thanks!

andatki··on Show HN: I Wrote a Book on PostgreSQL for Rails
Thanks! Appreciate it.
andatki··on Show HN: I Wrote a Book on PostgreSQL for Rails
Thank you!
andatki··on Show HN: I Wrote a Book on PostgreSQL for Rails
Use code turkeysale2023 for 40% off any Prag Prog book through November 30, 2023.
andatki··on Ruby on Rails: The Documentary [video]
Mind sharing your sass business, or the category? Always inspiring to hear about those.
andatki··on Ruby on Rails: The Documentary [video]
We (Rails programmers) appreciated all your amazing content and skills as an educator Ryan! A well-deserved Ruby Hero award recipient.
andatki··on Postgres: The next generation
That last idea is really good Tristan and I bet you’ll have interest. You could lead an online meetup. Melanie Plageman was interested in ideas like that as well. We briefly discussed different types of office hours.
andatki··on Postgres: The next generation
Thanks. This looks great!
andatki··on Vale.sh – A Linter for Prose
I’ve been editing my Markdown files with it and wrote about it here: https://andyatkinson.com/blog/2023/05/26/better-writing-vale
← PreviousPage 2 of 2