"59"..." /> "59"..." /> "59"..."/>

Messaging table performance - Merge from and to id`s into one single field vs separate 2 fields

23 views Asked by At

What would be the implications on performance on merging the users id from the "messages" table in form of "fromto" - ex userID - 5, userID 9 => "59" versus having two separate columns "from" and "to"?

Flow - list, read, delete messages when both id`s will be available in the application, so the query will retrieve all the messages for those 2 users

Also, even if the performance will be better when the fields will be merged, it would be a good idea to do it?

1

There are 1 answers

0
Kinexus On BEST ANSWER

What happens when you start getting more than single digit IDs?

What does 1111 equate to? 1 to 111, 111 to 1 or 11 to 11?

Stick with individual fields. It will be easier to interpret, manage and scale.