Project

General

Profile

What is the reason to have user_jid table?

Igor Khomenko
Added about 4 years ago

Hi there,

we checked a bit a logic with Offline storage for 1-1 messages and found that these messages are stored in msg_history table

but along with this Tigase also uses user_jid.

What is the reason to have user_jid table? As I see it only contains users JIDS info and the msg_history table has links to it."

Could you please clarify a bit


Replies (2)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 4 years ago

This is just kind of DB optimization. We reduce space used to store data as well as improve DB searching performance. We could store users' JIDs in msg_history table along with messages, however, please note, JID can potentially be 2048 characters long (according to the XMPP spec). As UTF-8 can be used for JIDs, it means that in extreme cases the JID can occupy even 6kB. Keeping this extra 6kB with every message record would be a great waste of space and would slow down the DB performance.

Instead, we have separate table with JIDs and only references in the msg storage table.

Added by Igor Khomenko about 4 years ago

Thanks Artur for the explanation, make sense

    (1-2/2)