I have a laravel application and i want to build an instant chat Module for my application.
I have made a database structure by using the logic of Eloquent relationships (hasMany, BelongsTo).
Here is the structure:
The problem about it is that there is 1 row for every chat between every user.
Which means: (so bad) :(
for 50 users, 50•((50-1)/2) = 1225 rows
for 100 -> 4950
and for 250 users which is possible -> 31125 rows on channels table which will be queried in every message.
I need suggestions to make this smaler somehow
Thanks!