I am designing an app that would involve users ‘following’ each other’s activity, in the twitter sense, but I am not very experienced with database/query design/efficiency. Are there best practices for managing this, pitfalls to avoid, etc.? I gather this can create a very large load on the db if not done properly (or maybe even then?).
If it makes a difference it is likely that people will ‘follow’ only a relatively small number of people (but a person may have many followers). However this is not certain, and I wouldn’t want to count on it.
Any advice gratefully received. Thanks.
Pretty simple and easy to do with full normalisation. If you have a table of users, each with a unique ID, you would have a
TABLE_FOLLOWERStable with the columns,USERIDandFOLLOWERIDwhich would describe all the followers for each user as a one to one to many relationship.Even with millions of assosciations on a half decent database server this will perform well and fast as long as you are using a good database (IE, not MS-Access).