title: I want to log all mqtt messages of the broker. How should I design schema of database. Avoiding dulplicate entries and fast searching
body: <p>I am implementing a callback in java to store messages in a database. I have a client subscribing to '#'. But the problem is when this # client disconnects and reconnect it adds duplicate entries in the database of retained messages. If I search for previous entries bigger tables will be expensive in computing power. So should I allot a separate table for each sensor or per broker. I would really appreciate if you suggest me better designs.</p>