Hi, I’m develpoing a POS system using realm. Of course this have sales, items, taxes, etc and by the type of system this would need a lot of Statistics to be shown.
My question is, would be recommended to use auxiliary collections to store the data in a way is would be optimized for collection that data?
For example, let’s say I have a Order->Item document relation. The items has a lot of fields, tax related, users, etc. If I need a report for hourly sales I would be benefited by having the date store as 3 string:
'month":“MM”, ‘day’:'DD, ‘hour’:‘HH’ instead of the classic bson type Date.
So I would have a collection with this document:
{
item: 'T-shirt',
quantity: x
total: x
year:
month:
hour: //
}
separated from the collection that has the actual order item data. Would be this a good practise? Considering that all those collections are read-only (once created, wouldn’t be modified).
Or it would be just better(or the same) to add those extra fields in the Item collection and querty directy in there?
Of course this would increase storage space but would I get some processing cpu/time benefit?
Any article about good practices would be welcomed.
thanks!