3 ms·
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. F
by tghw 14y ago
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.