How can I store a large list in a database

一笑奈何 提交于 2019-12-13 10:17:09

问题


I want to store a large list of urls in a database, each list has an Id and the urls in two different list are most likely not the same, meaning that there is very small intersection between to different list of urls. The size of the list is not know and vary from one list to the other.

Currently, I am storing the list as a string in a field of a PostgreSQL database, I know it is not a good solution so I am looking for a better one.

Things I came up with are :

  • Store each url in a separate table and link them with a one to many relationship. I don't think this solution is very good because as I said the url will probably be present in only one list.
  • Go for some NoSQL solution (mongoDB), but as I never tried this, I wanted to see if you guys had any better solutions.

Thank you for your answers.


回答1:


You should make a many-to-many relation between the two tables "lists" and "urls"




回答2:


I can help you with mysql.
In mysql u can go with 1 table.
By using 3 Columns: ID, URL1, URL2



来源:https://stackoverflow.com/questions/14979010/how-can-i-store-a-large-list-in-a-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!