Where is it best to store a reference of the user-selected default? Consider a user can have multiple addresses. There is a users table, an addresses table, and a user_addresses table that links addresses and users with a many to many relationship.
Users can define what their default address is.
Is it best to have the users table have a default_shipping_id column linking to the appropriate entry on user_addresses, or should the user_addresses table have a is_default column?
Users table




ID
name
default_user_address_id




--------
--------------
--------------




v.s.
User_addresses table




ID
user_id
address_id
is_default




--------
--------------
--------------
--------------




What's the better approach here?
It doesn't matter.
As you have to get the message from the second table, you always have to inner join it , and add a where clause, to get the right one.
So the only thing would be size.
A boolean needs 1 byte.
Your default_user_address_id would be bigint which needs 8 Bytes, so as most people have only 1 address or maybe two, you would save space with Booleans.
So my vote would be for number two, as it would save size.