~/talk

From PostgreSQL to SQLite in Rails

Talkat wroc_love.rb 2025 · 2025-04-11..04-13· [ruby, databases]
links:none on file
slides:none on file

Migrates a Rails app from PostgreSQL to embedded SQLite (Escalite) and reports it works: schema and types converted with ActiveRecord custom types, arrays moved to JSON, solid stack gems used alongside, data migrated with an open-source script, tests pass, downtime about one to two hours, and requests halve while costs drop dramatically. Notes trade-offs: migrated entire Rails app in ~3 days, cut infra costs from ~$650/mo to $77/mo, single-writer SQLite concurrency limits, backups via Litestream to S3/R2.

AI-written summary · about

  1. 0:00Introduction
  2. 1:10Why switch to SQLite
  3. 3:01Benefits of embedded database
  4. 5:09Dropping Docker and simplifying deployment
  5. 6:35Cost savings and infrastructure changes
  6. 8:24Migration process overview
  7. 9:48Incremental migration strategy
  8. 10:52Handling unsupported PostgreSQL types
  9. 14:49Migrating PostgreSQL arrays to JSON
  10. 15:58Adopting Solid Cache and Solid Jobs
  11. 16:39Dropping constraints before migration
  12. 17:25Final data migration steps
  13. 18:11SQLite extensions and custom functions
  14. 23:29Custom Ruby functions in SQLite
  15. 25:17Sorting differences between PostgreSQL and SQLite
  16. 26:20Concurrency limitations in SQLite
  17. 28:52Data migrations and row locking
  18. 30:16Foreign key error challenges
  19. 31:20Scaling SQLite and replication options
  20. 34:12Trade-offs and final verdict
  21. 35:00Q&A: Backups and replication
  22. 37:06Q&A: Migration with Solid Queue
  23. 37:47Q&A: Local PostgreSQL vs SQLite
  24. 39:31Q&A: Migration timeline and regrets
  25. 41:00Q&A: Database size and records
  26. 41:41Q&A: N+1 queries and memory overhead
  27. 43:28Q&A: Data migration and downtime
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.