2.3 Collections versus Documents

MonetDB/XQuery allows you to store multiple XML collections. Each XML collection in itself consists of at least one XML document, and is stored in a fixed set of tables (a main 100000XX_rid table containing XML nodes, and supporting tables for text and attributes, QNames, etc). In principle, an XML collection can contain many (even millions) of documents. Thus, deciding to store many XML documents in a single collection, creates much less internal relational tables than storing each document in a separate collection (which is default).

On the other hand, storing documents together in the same collection means that access to these documents will create some interference (locking the tables, and shared index maintenance). So, the decision how to group your XML documents in collections is a physical database design problem that the database administrator should think about.

These trade-offs are described further in the Performance Tips section (see Separate Documents vs Document Collections).

A collection exists as long as it holds at least one document. When the last is deleted, it automatically disappears.