Hi Mansi,
I am storing deeply nested hierarchal data in XML files. Simply put, most of my queries are going to be relative (For e..g //@name). So, I am assuming it would be a huge performance hit. Specially, when I know each "ID" will most definitely have multiple XML documents. Correct me, if I am wrong here.
Usually, one identifier (ID) exists to reference one data entity (document, row, etc.). You say that more than one document will be assigned to a single ID, so you seem to work with 1:n relationships. For what does your ID stand for?
The notion of tables stems from the relational database world. In XML, you work with documents and collections, so it's a well-established procedure to reference documents by their database path. 1:n relationships can e.g. be represented in another database, which would contain a document with the following structure:
<docs> <doc id='0'>a.xml</doc> <doc id='0'>b.xml</doc> </docs>
A query like the following one could be used to address these documents:
for $doc in db:open('db-ids')//doc[@id = '0'] return db:open('db', $doc)
If your id database is indexed, access will be very fast (within fragments of milliseconds).
I agree it takes some time to understand the logics that I sketched out here, but once you are into it, it works out perfectly fine.
Hope this helps Christian