简体   繁体   中英

mysql database storing best practice for storing data, lots of small amounts or small amounts of large

I have two tables that hold information, one of properties and one of investors and I want to store investors that are interested in certain properties.

I am making a third linking table to store this information, but I'm not sure which is best practice, should I store one investor ID and many property ID's in one row (or one property ID to investor ID's) or should I do individual ones?

My problem is if I do individual ones the number of rows could easily go into the tens of thousands in a couple of months, but having many in one column will be a hefty number too.

Which is best practice? Small quantity of large data, or large quantities of small data?

(Also worth mentioning that I need to keep the data for reports so deleting them is out of the question.)

The "Best Practice" is going to be to normalize your data, which in this case sounds like having large quantities of small data. Assuming you make both records the primary key, this look up should be relatively fast even for tens of thousands of rows.

Also in general you wont' have issues with data in SQL until you hit millions and for small properly indexed tables like this I don't forsee an issue.

Normalizing your data says that your linking table should store just one investor ID and one property ID.

Have tens of thousands of records isn't generally considered to be a large number for a MySQL table to hold. Just make sure you're indexing things properly to help speed up access.

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