开发者

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:

  1. SELECTing the data to get it out of the database, to the application
  2. Manipulating the data in the application
  3. UPDATE statement to write the updated JSON array back to the table

Which is simpler/more efficient to you?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜