For my new app - a (kind of) chat for Android - I want to store my messages locally in a database. I recently got a glimpse on how others do it. So I saw the SQLite database of Whatsapp on my mobile. There they are putting all chat messages of every conversation in the same table. The point is when reading / writing new messages sorting hundred thousands of messages in order to show only the ones with your conversation partner seems a lot of efford.
I thought by myself I wanted to make one table for each chat. So I can simply load the messages directly without checking the author - since the table name would be the user name I'm talking to. I assumed this might go much faster - especially if you have many messages.
My question is, why are they doing it all in one table? Is it wrong to make one for each chat (E.g. any limitations like "Android can only handle 10 tables per Database")?
I know it's a very theoretical question but perhaps someone might give me a hint how to do it properly!
Thanks!
Aucun commentaire:
Enregistrer un commentaire