Database Reference
In-Depth Information
Name
URI
db
/db
books
/db/books
history
/db/books/history
sci-fi
/db/books/sci-fi
films
/db/films
Careful organization of your documents into collections in eXist can vastly improve
query performance. It is sensible to organize your documents into collections based
on the queries that you will want to make of them; typically this is also the way that
your organization logically thinks about documents and their meaning.
Organizing documents into collections and querying only those collections that are
relevant reduces the amount of documents that eXist must interrogate during a
query, and hence this approach lends itself to more efficient processing. In
Figure 4-9 , for example, you might want to answer queries about all history topics; by
querying just the /db/books/history collection, you ensure that you are not querying
any documents that you already know are irrelevant. You can also answer queries
about all topics by querying the /db/books collection, as this will query each of its sub‐
collections recursively.
Documents
Documents are the basic unit that you work with in eXist, and they come in two
forms: XML documents and binary documents. eXist is not particularly fussy about
how you organize your information into documents; whether you choose to use sev‐
eral large documents or many smaller documents, eXist will happily store your data.
However, your data architecture is an important concern for your business and appli‐
cations, so here are some concerns that you should consider when deciding on docu‐
ment granularity:
Locking
When a document is being read, it is read locked , which means that any incom‐
ing updates to the document will be blocked. If you have a few large documents
and your system is not mostly concerned with reads, this can introduce conten‐
tion for the document. If you instead have several smaller documents, they can
be read and updated independently. Likewise, when you are updating a docu‐
ment, it is write locked . If you have several smaller documents rather than a few
large documents, several updates can take place independently.
 
Search WWH ::




Custom Search