According to the documentation one should not store very big documents and rather split it up into smaller documents and do a join when doing a query.
Let’s say I’m trying to create an order form.
I have an order document that links to a product. I have a product document that links to items used in the product and I have an item document. Mostly there won’t be more than 30 products on an order and not more than 20 items in a product.
1 - How big is a big document as defined by the documentation?
2 - Is it better to do lot’s of small queries or one big query that joins the parts for you? Is the cost than a query more than a join?
Any help appreciated,
It is very hard to say what the optimal size of Tamino documents is. It depends on many factors, like the number of elements and attributes inside the document or the queries that are stated against the documents. So, basically you have to find the optimum that lies in between the ?all-in-one? and the ?relational? approach.
Assuming that an item is not a very complex object it shouldn?t be a problem to have one document per product that contains all its items. I would store the orders in a separate doctype. But, the reason for this is not that I?m afraid of getting too big documents. The reason is that I want to store products that might have not been ordered yet.
Finally I strongly suggest no to state a lot of ?small? queries and joining their result in the application. Since it is very unlikely that the application can do a more efficient join processing than Tamino, join operations should be done by stating appropriate XQuery statements.