[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"branding":3,"analytics":7,"article-sqlite-slows-down-when-you-use-uuid-primary-keys":10,"sections":36},{"siteName":4,"siteTagline":5,"publisherName":4,"contactEmail":6},"The Revision","Tech news, decoded.","editor@therevision.news",{"gaMeasurementId":8,"adsenseClientId":9},"G-ZW2MV82GYR","ca-pub-8533917693782264",{"article":11},{"id":12,"slug":13,"title":14,"dek":15,"body_md":16,"tags_json":17,"published_at":18,"created_at":19,"updated_at":20,"status":21,"review_note":22,"review_notes":23,"image_url":24,"persona_id":22,"persona_name":22,"section":25,"tags":26,"sources":31,"feedback":35,"feedback_at":22,"cost_usd":35,"total_tokens":35},336,"sqlite-slows-down-when-you-use-uuid-primary-keys","UUID Primary Keys Are Quietly Hurting Your SQLite App","A developer deep-dive explains why the UUID-as-primary-key habit, imported from distributed databases, quietly taxes SQLite performance.","A developer post lays out why UUID primary keys in SQLite quietly tank performance — and why most teams never notice until the table is large.\n\nSQLite organizes rows in a B-tree indexed by the primary key. Auto-incrementing integers insert in order, staying cache-friendly and avoiding tree restructuring. UUIDs — the v4 variant most teams reach for by default — are random, so each insert lands at an arbitrary position in the tree, triggering page splits and cache misses. Storing them as 36-character text strings makes it worse: each key occupies roughly four times the space of a 64-bit integer.\n\nSQLite is mostly an embedded database — mobile apps, desktop tools, local-first software — where cross-system uniqueness rarely matters. The UUID habit migrated from distributed stacks where it solves a real coordination problem, into SQLite deployments where it mostly just creates one.\n\nUUIDv7 addresses most of this by embedding a timestamp prefix that keeps inserts roughly sequential — a fix that's been standardized since 2022. That most teams are still defaulting to v4 suggests the problem isn't widely understood, or that SQLite performance simply doesn't get profiled until something breaks.","[\"sqlite\",\"databases\",\"performance\",\"uuid\"]","2026-06-05T23:13:12.000Z","2026-06-06T01:06:38.717Z","2026-06-18T05:17:46.868Z","published",null,[],"https:\u002F\u002Fcdn.xyz.onl\u002Farticle-images\u002Fsqlite-slows-down-when-you-use-uuid-primary-keys.webp","dev-tools",[27,28,29,30],"sqlite","databases","performance","uuid",[32],{"name":33,"url":34},"Hacker News","https:\u002F\u002Fandersmurphy.com\u002F2026\u002F06\u002F05\u002Fthe-perils-of-uuid-primary-keys-in-sqlite.html",0,{"sections":37},[38,43,48,53,58,63,68,73,78,82,87,92,97,102],{"name":39,"slug":40,"count":41,"latest_published_at":42},"AI","ai",2602,"2026-07-18T18:30:00.000Z",{"name":44,"slug":45,"count":46,"latest_published_at":47},"Security","security",315,"2026-07-17T19:30:00.000Z",{"name":49,"slug":50,"count":51,"latest_published_at":52},"Deals","deals",179,"2026-06-29T20:02:07.000Z",{"name":54,"slug":55,"count":56,"latest_published_at":57},"Policy","policy",169,"2026-07-17T19:49:53.000Z",{"name":59,"slug":60,"count":61,"latest_published_at":62},"Hardware","hardware",126,"2026-07-16T20:09:48.000Z",{"name":64,"slug":65,"count":66,"latest_published_at":67},"Consumer Tech","consumer-tech",94,"2026-07-16T16:29:46.000Z",{"name":69,"slug":70,"count":71,"latest_published_at":72},"Software","software",72,"2026-07-17T09:42:05.000Z",{"name":74,"slug":75,"count":76,"latest_published_at":77},"Science","science",66,"2026-07-10T10:29:37.000Z",{"name":79,"slug":25,"count":80,"latest_published_at":81},"Dev Tools",60,"2026-07-16T16:59:13.000Z",{"name":83,"slug":84,"count":85,"latest_published_at":86},"Startups","startups",42,"2026-07-16T16:30:35.000Z",{"name":88,"slug":89,"count":90,"latest_published_at":91},"Gaming","gaming",41,"2026-07-09T04:00:00.000Z",{"name":93,"slug":94,"count":95,"latest_published_at":96},"General","general",29,"2026-07-10T22:28:58.000Z",{"name":98,"slug":99,"count":100,"latest_published_at":101},"Reviews","reviews",20,"2026-06-24T12:00:01.000Z",{"name":103,"slug":104,"count":105,"latest_published_at":106},"How-To","how-to",6,"2026-06-16T09:00:00.000Z"]