database - Many-to-many relations - lots of them -


i have general question stroring relations in database.

let's take social example: followers. want store friend (id 1) following friend b (id 5).

i many-to-many relation in database.

inserting:

  table flw (friend,following,relation_id): (1,5,1) 

and continue.. million relations friends a,b,c,d,...

now question is, when need fetch relations friend (or b,c,...) following.. needs trough million of records. still effective ? can't image facebook goes trough billion of rows friends list.

the solution use more 1 database. (millions of many-to-many-relations) (only) correct way store what's in example ?


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -