问题
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