简体   繁体   中英

How can I store a large list in a database

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.

您应该在两个表“列表”和“ URL”之间建立多对多关系

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM