Dear all at BaseX,
Can pre values change in add-documents-only databases ?
Can pre values change in add/delete-documents-only databases ?
Here is the big picture : I have a Document DB, references by a Index DB which stores (key,pre) couples, Where pre are pre values in the Document DB. Document DB documents are only added (or sometimes deleted). Do I have to use id values or can I use pre values ?
Best regards
Fabrice Etanchaud Questel-Orbit
Hi Fabrice,
Can pre values change in add-documents-only databases ?
using the latest version of BaseX (maybe also with 7.3 or previous versions? I don’t remember), pre values for existing documents will never change, even if you add new documents.
This is not valid, however, in the second case you mentioned:
Can pre values change in add/delete-documents-only databases ?
The reason can be explained by picking up your third question:
Where pre are pre values in the Document DB.
Pre values are not stored in the database; instead, they are implicitly given by the table position of node entries [1]. If a document is deleted, the pre values of all subsequently stored documents will automagically decrease.
As a consequence…
Do I have to use id values or can I use pre values ?
…this simply depends on your use case ;)
Christian
Hi Fabrice,
just to supplement Christian's answer I guess that in your case working with pre values is not sufficient. Adding documents should be no problem. However if you delete a document and said document does not have the highest pre value among all documents, pre values will shift. Think of pre values as a row identifier - if you remove one row in the middle the succeeding row takes its place and so on ...
There are other posibilities:
1) As you said, using id instead of pre works for sure. Depending on your use case, the pre/id mapping of BaseX may be sufficient.
2) You could also continue to use pre values and think about updating your index DB, that means updating the (key, pre) pairs for all pre values that are higher than the deleted document. Depending on the nature of your mapping (and whether it's possible to leverage any indexes) plus the frequency of deletions this could be something to think about. I estimate that the update of your index DB itself should be cheap and overall performance basically comes down to retrieving (key,pre) pairs and keeping existing indexes up-to-date.
... but quite possibly this is all total nonsense and a product of constant brain-frying for the last 10-15 hours. I hope somebody will put it right then ...
Cheers and good night! Lukas
On 02.11.2012, at 21:44, "Christian Grün" christian.gruen@gmail.com wrote:
Hi Fabrice,
Can pre values change in add-documents-only databases ?
using the latest version of BaseX (maybe also with 7.3 or previous versions? I don’t remember), pre values for existing documents will never change, even if you add new documents.
This is not valid, however, in the second case you mentioned:
Can pre values change in add/delete-documents-only databases ?
The reason can be explained by picking up your third question:
Where pre are pre values in the Document DB.
Pre values are not stored in the database; instead, they are implicitly given by the table position of node entries [1]. If a document is deleted, the pre values of all subsequently stored documents will automagically decrease.
As a consequence…
Do I have to use id values or can I use pre values ?
…this simply depends on your use case ;)
Christian
[1] http://docs.basex.org/wiki/Node_table_storage _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de