Skip to content

Comment on Using Postgres Arrays in Djangoparent

Comments

Arrays are useful when order matters. Traditionally, in SQL, you would have to have an `order` field, which takes a bit of overhead to keep correctly ordered. For example, if you wanted to swap two items, you'd need a transaction around it to prevent race conditions. Likewise, deleting an item requires updating the `order` field of each item after the deleted one. With an array, the order is inherent in the structure.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.