Our great database migration
Shepherd, an insurance pricing company, migrated from SQLite to Postgres to boost performance and scalability for their pricing engine, "Alchemist." The process involved code changes, adopting Neon database, and optimizing performance post-migration.
Read original articleThe article discusses the database migration process undertaken by Shepherd, a company specializing in insurance pricing. The migration involved moving from SQLite to Postgres to enhance performance and scalability. The pricing engine, named "Alchemist," underwent significant improvements to handle the growing complexity of pricing models. The decision to migrate was driven by the need to accommodate the company's expanding business operations and introduce new insurance products in 2024. The migration process involved selecting the Neon database solution, making code changes to adapt to a serverless architecture, and enhancing developer experience by automating data handling processes. Despite facing initial latency issues post-migration, the team implemented strategies such as server proximity, caching, and parallelizing functions to optimize performance. The article highlights the importance of maintaining data transparency, ensuring compatibility with existing systems, and improving developer efficiency throughout the migration process.
Related
Schema changes and the Postgres lock queue
Schema changes in Postgres can cause downtime due to locking issues. Tools like pgroll help manage migrations by handling lock acquisition failures, preventing application unavailability. Setting lock_timeout on DDL statements is crucial for smooth schema changes.
Postgres Schema Changes and Locking
Schema changes in Postgres can cause downtime by locking out reads and writes. Migration tools help mitigate issues. Breakages during migrations can affect client apps or lock database objects, leading to unavailability. Long queries with DDL statements can block operations. Setting lock_timeout on DDL statements can prevent queuing. Tools like pgroll offer backoff and retry strategies for lock acquisition failures. Understanding schema changes and DDL impact helps ensure smoother migrations and less downtime.
Supabase (YC S20) Is Hiring Postgres SREs
Supabase seeks a Site Reliability Engineer to manage Postgres databases remotely. Responsibilities include enhancing reliability, ensuring high availability, and optimizing performance. Ideal candidates possess multi-tenant database experience, Postgres tools proficiency, and AWS deployment skills. Benefits include remote work, equity, health coverage, and tech allowance.
PostgreSQL Statistics, Indexes, and Pareto Data Distributions
Close's Dialer system faced challenges due to data growth affecting performance. Adjusting PostgreSQL statistics targets and separating datasets improved performance. Tips include managing dead rows and optimizing indexes for efficient operation.
Serving a billion web requests with boring code
The author shares insights from redesigning the Medicare Plan Compare website for the US government, focusing on stability and simplicity using technologies like Postgres, Golang, and React. Collaboration and dedication were key to success.
This seems like a decent reason to stop committing the database to GitHub, but not a reason to move off SQLite.
If you have a small, read-only workload, SQLite is very hard to beat. You can embed it ~everywhere without any network latency.
I'm not sure why they wouldn't just switch to uploading it to S3. Heck, if you really want a vendor involved that's basically what https://turso.tech/ has productized.
They didn't make this change for performance reasons.
They could have probably stayed with SQLite, in fact, because most likely it's a serious indexing problem, and then found a better way to distribute the 80MB file rather than committing it to Github. (Although there are worse ideas, esp with LFS)
These numbers are thrown out there like they're supposed to be impressive. They must be doing some really complex stuff to justify that. For a web server to have a p79 of 1 second is generally terrible.
> 79.01% to average 2 seconds or less
And after the migration it gets FAR worse.
I get that it's a finance product, but from what they wrote it doesn't seem like a large dataset. How is this the best performance they're getting?
Also a migration where your p79 (p-anything) doubled is a gigantic failure in my books.
I guess latency really mustn't be critical to their product
People tend to forget that using The Cloud (tm) still means that there's copper between a database server and an application server and physics still exist.
What I'm curious about is whether Neon can run pg locally on the app server. The company's SaaS model doesn't seem to support that, but it looks technically doable, particularly with a read-only workload.
These are the sort of technical struggles a high school student learning programming encounters. Not a well-funded series A startup. This is absolutely bonkers.
It's... an 80MB database. It couldn't be smaller. There are local apps that have DBs bigger than that. There is no scale issue here.
And... it's committed to GitHub instead of just living somewhere. And they switched to Neon.
To me, this screams "we don't know backend and we refuse to learn".
To their credit, I will say this: They clearly were in a situation like: "we have no backend, we have nowhere to store a DB, but we need to store this data, what do we do?" and someone came up with "store it in git and that way it's deployed and available to the app". That's... clever. Even if terrible.
What?
What possessed them?
Related
Schema changes and the Postgres lock queue
Schema changes in Postgres can cause downtime due to locking issues. Tools like pgroll help manage migrations by handling lock acquisition failures, preventing application unavailability. Setting lock_timeout on DDL statements is crucial for smooth schema changes.
Postgres Schema Changes and Locking
Schema changes in Postgres can cause downtime by locking out reads and writes. Migration tools help mitigate issues. Breakages during migrations can affect client apps or lock database objects, leading to unavailability. Long queries with DDL statements can block operations. Setting lock_timeout on DDL statements can prevent queuing. Tools like pgroll offer backoff and retry strategies for lock acquisition failures. Understanding schema changes and DDL impact helps ensure smoother migrations and less downtime.
Supabase (YC S20) Is Hiring Postgres SREs
Supabase seeks a Site Reliability Engineer to manage Postgres databases remotely. Responsibilities include enhancing reliability, ensuring high availability, and optimizing performance. Ideal candidates possess multi-tenant database experience, Postgres tools proficiency, and AWS deployment skills. Benefits include remote work, equity, health coverage, and tech allowance.
PostgreSQL Statistics, Indexes, and Pareto Data Distributions
Close's Dialer system faced challenges due to data growth affecting performance. Adjusting PostgreSQL statistics targets and separating datasets improved performance. Tips include managing dead rows and optimizing indexes for efficient operation.
Serving a billion web requests with boring code
The author shares insights from redesigning the Medicare Plan Compare website for the US government, focusing on stability and simplicity using technologies like Postgres, Golang, and React. Collaboration and dedication were key to success.