HackerTrans
TopNewTrendsCommentsPastAskShowJobs

andatki

no profile record

Submissions

Christmas Outage to #1 App Store Ranking: An Aura Frames Postgres Scaling Retro

andyatkinson.com
7 points·by andatki·27 дней назад·1 comments

Tip: Put your Rails app on a SQL query diet

andyatkinson.com
4 points·by andatki·в прошлом году·0 comments

Big Problems from Big in Lists with Ruby on Rails and PostgreSQL

andyatkinson.com
3 points·by andatki·в прошлом году·0 comments

Django and Postgres for the Busy Rails Developer

andyatkinson.com
2 points·by andatki·2 года назад·0 comments

PostgreSQL 17: JSON_table(), Merge with Returning, and Updatable Views

andyatkinson.com
2 points·by andatki·2 года назад·0 comments

Solid Cache for Rails and PostgreSQL

andyatkinson.com
3 points·by andatki·2 года назад·1 comments

Trying Out Solid Queue and Mission Control with PostgreSQL

andyatkinson.com
3 points·by andatki·2 года назад·0 comments

Top Five PostgreSQL Surprises from Rails Developers

andyatkinson.com
8 points·by andatki·2 года назад·2 comments

IndieRails – Andrew Atkinson – The Postgres Specialist

andyatkinson.com
1 points·by andatki·2 года назад·0 comments

Merging and Splitting Partitions with Minimal Locking PostgreSQL 17

andyatkinson.com
1 points·by andatki·2 года назад·0 comments

Rails and Postgres – Postgres.FM 086 podcast

postgres.fm
1 points·by andatki·2 года назад·1 comments

comments

andatki
·27 дней назад·discuss
Happy to discuss any details from the post. Thanks for taking a look.
andatki
·6 месяцев назад·discuss
https://andyatkinson.com
andatki
·7 месяцев назад·discuss
If merging or moving data between environments is a regular occurrence, I agree it would be best to have non-colliding primary keys. I have done an environment move (new DB in different AWS region) with integers and sequences for maybe a 100 table DB and it’s do-able but a high cost task. At that company we also had the demo/customer preview environment concept where we needed to keep the data but move it.
andatki
·7 месяцев назад·discuss
Great!
andatki
·7 месяцев назад·discuss
Good addition!
andatki
·7 месяцев назад·discuss
This was written based on working on several Postgres databases at different companies of “medium” size as a consultant, that had excessive IO and latency and used UUID v4 PKs/FKs. They’re definitely out there. We could transform the schema for some key tables as a demonstration with big int equivalents and show the IO latency reduction. With that said, the real world PK data type migration is costly but becomes a business decision of whether to do or not.
andatki
·7 месяцев назад·discuss
Appreciate it!
andatki
·7 месяцев назад·discuss
Note that if you’re using UUID v4 now, switching to v7 does not require a schema migration. You’d get the benefits when working with new records, for example reduced insert latency. The uuid data type supports both.
andatki
·7 месяцев назад·discuss
Hi there. Thanks for the feedback. I updated that section to hopefully convey the intent more. The type of ordering we care about for this topic is really B-Tree index traversal when inserting new entries and finding existing entries (single and multiple values i.e. an IN clause, updates, deletes etc). There's a compelling example I re-created from Cybertec showing the pages needed and accessed for equivalent user-facing results, comparing storing PKs as big integers vs. UUID v4s, and how many more pages were needed for v4 UUIDs. I found that to be helpful to support my real world experience as a consultant on various "medium sized" Postgres databases (e.g. single to 10s of millions of records) where clients were experiencing excessive latency for queries, and the UUID v4 PK/FKs selection made for reasons earlier was one of the main culprits. The indexes wouldn’t fit into memory resulting in a lot of sequential scans. I’d confirm this by showing an alternative schema design and set of queries where everything was the same except integer PKs/FKs were used. Smaller indexes (fit in memory), reliable index scans, less latency, faster execution time.
andatki
·7 месяцев назад·discuss
Good point that the post should be made clear it’s referring only to my experience with Postgres.
andatki
·в прошлом году·discuss
I’ve used Marp a lot and it’s great. Column layouts and code highlighting are two features Presenterm offers that I don’t think are available in Marp.
andatki
·в прошлом году·discuss
What sorts of skills are you looking to build? Since this post has a lot of comments about query optimization, I’d suggest query optimization is more in the realm of developers and not DBAs. Schema, query, and index design. DBAs might be more focused on replication/HA, security, fleet management, backups, DR.

Happy to help with more targeted recommendations!
andatki
·2 года назад·discuss
Nice post covering many of the main ways to improve efficiency.

Here’s a related post I wrote for AppSignal:

What's Coming in Ruby on Rails 7.2: Database Features in Active Record https://blog.appsignal.com/2024/07/24/whats-coming-in-ruby-o...

For folks interested in additional depth on optimizing Postgres for use with Active Record/Rails, please check out my book:

High Performance PostgreSQL for Rails https://andyatkinson.com/pgrailsbook

Thanks!
andatki
·2 года назад·discuss
What a name! - A dot Atkinson
andatki
·2 года назад·discuss
Rails and Postgres (and AWS) was the pre-acquisition stack, and development continued with that stack during this time period (2020-2021). https://en.wikipedia.org/wiki/Flip_(software)

Microsoft acquired companies with web and mobile platforms with varied backgrounds at a high rate. I got the sense that the tech stack—at least when it was based on open source—was evaluated for ongoing maintenance and evolution on a case by case basis. There was a cloud migration to Azure and encouragement to adopt Surface laptops and VS Code, but the leadership advocated for continuing development in the stack as feature development was ongoing, and the team was small.

Besides hosted commercial versions, I was happy to see Microsoft supporting community/open source PostgreSQL so much and they continue to do so.

https://en.wikipedia.org/wiki/List_of_mergers_and_acquisitio...

https://techcommunity.microsoft.com/t5/azure-database-for-po...
andatki
·2 года назад·discuss
Hi there! That's funny! This interview and those gem updates were unrelated. However both are part of the sweet spot for me of education, advocacy, and technical solutions for PostgreSQL and Ruby on Rails apps.

I hope you’re able to check out the podcast episode and enjoy it. Thanks for weighing in within the gem comments, and for commenting here on this connection. :)
andatki
·2 года назад·discuss
Great list of Postgres features called out that highlight the extensive feature set.

Most of these are covered in my book, for anyone that’s interested in learning them. The book uses a Ruby on Rails app with Postgres instances for examples and exercises. Hope the plug is ok here as some folks may be looking for learning resources for Postgres. https://andyatkinson.com/pgrailsbook
andatki
·2 года назад·discuss
Newer versions of Postgres also support dropping indexes concurrently. I recommend using the concurrently option when dropping unused or unneeded indexes on any table with active writes and reads. https://www.postgresql.org/docs/current/sql-dropindex.html
andatki
·2 года назад·discuss
Makes sense. Check out the implementation of automatic lock timeout retries in Strong Migrations.

Lock Timeout Retries [experimental] https://github.com/ankane/strong_migrations
andatki
·2 года назад·discuss
Do you do any alerting for INVALID indexes? For example, by default PgHero will display them prominently and I believe PgAnalyze does as well. My thought is to put the energy into making INVALID indexes highly visible. Perhaps combined with a process step. 1. Any CREATE INDEX CONCURRENTLY migrations go out in their own deployment. 2. Any queries that depends on that index being present means a PR has a process step asking the author to verify that the index exists and is valid. That way you wouldn't have to lose if_not_exists.

That all said, still would be cool to make this the default in Active Record. Nice idea!