32,383 karma · joined Jan 3, 2008 (18y ago) · 8,295 submissions
comment 3mo ago · link · parent
So now I marvel at how I used to be able to sleep without them and ponder over why we either have no fatty pads (or muscle, even!) on the inside sides of our knees or have reduced sensitivity in that region, since we’re clearly meant to be side sleepers (it’s the healthiest position, assuming you can find a rock or log to place under your head, or even just your hands folded together).
comment 3mo ago · link · parent
comment 4mo ago · link · parent
More usefully, a uuidv7 can take the place of both the id and the created_at field (if precision is sufficient), and can (depending on your security comfort) also take the place of the uuidv4 public id field.
With uuidv7 the data is naturally sorted so you don’t run into the issues with btree worst case scenarios that you would with a uuidv4 id, and you can even take it a step further and use BRIN instead of btree indexes for a massive boost (also applicable to serial ids, though).
comment 4mo ago · link · parent
comment 4mo ago · link · parent
* Use uuidv7 not uuid in general (typically v4)
* in addition to minimizing locked records, make sure your locks are ordered deterministically across all queries (eg by id asc, always) or you’ll deadlock (but postgres has a really good deadlock detector so you’ll more likely just error out if you’re lucky)
* always use explain (generic_plan) to be able to a) copy-and-paste your queries with placeholders for parameters as-is, b) see how your query will actually be optimized when Postgres doesn’t have visibility into the specific parameter values
* use set seqscan = off when testing your query plans esp when tables are empty or nearly so so you can see if indexes will be used when seq scans become less cheap
* everyone defaults to btree indexes which are heavy and increase index bloat. Consider using a hash index instead if you just need to look up by column/id but not sort or get values greater/lesser than a param. You can’t create unique hash indexes but you can create exclude using hash constraints for the same effect (except no multicolumn unique index support)
* learn about GIN (and GIST) indexes. They can speed up common queries without needing new syntax, something people coming from MySQL might not expect to be possible; i.e. you can use them to speed up Plain Jane like ‘%foo%’ queries without switching to FTS.
comment 4mo ago · link · parent
Obviously past a certain point carting around full backups becomes time/dollar prohibitive, but this can take you very far.
comment 4mo ago · link · parent
3.5 Flash Lite is only a hair cheaper than 3.0 Flash, but I think 3.0 Flash is a massively more capable model?
comment 4mo ago · link · parent
What part of this is AI? What part of that couldn’t have been done without it? Do they just mean they vibecoded it?