Storing Allowed Websites Per User in Postgres
I have a User table in my Postgres database. In my application, the User can have various allowed websites. My question is: which is more disk space efficent, having a many-to-many relationship between a user and a url or storing the开发者_StackOverflow中文版 array in JSON in a column in the User table. Essintially, how much space does postgres use to store table headers.
Thanks.
which is more disk space efficent, having a many-to-many relationship between a user and a url or storing the array in JSON in a column in the User table.
Updating a many-to-many relationship means an UPDATE (and/or DELETE?) statement.
Updating a JSON array stored in a database tables means:
- SELECTing the data to get it out of the database, to the application
- Manipulating the data in the application
- UPDATE statement to write the updated JSON array back to the table
Which is simpler/more efficient to you?
精彩评论