John,

   What I'm interested in is not so much a strategy for generating unique IDs 
but rather imposing a constraint on the content in the database.  Yes, there 
are ways of creating IDs that are very unlikely to clash, but that's not really 
the crux of the new feature I'm suggesting.

   I want a unique value range index that will guarantee uniqueness for an 
element/attribute value in the database both now and later.  Once a document 
has been inserted that contains the indexed value <foo>bar</foo>, for example, 
I don't want any other document to ever be inserted with that element value 
(until the first one is deleted, of course).

   This guarantee of uniqueness could be useful in several applications where 
you don't have control of ID generation.  For example, processing events where 
the unique value is an external system ID.  A system like CPF could use unique 
IDs to track progress of job state where the unique ID is a document URI.  And 
so on. 

   Giving it a little more thought, there may be some interactions with 
permissions that could get a bit tricky.  You and I may each insert a document 
with the same value, but if we can't see each other's documents then both 
values should exist.  But I'm sure that's not a tough problem.

---
Ron Hitchens {[email protected]}  +44 7879 358212

On Jun 4, 2014, at 7:50 PM, John Snelson <[email protected]> wrote:

> On 04/06/2014 19:31, Ron Hitchens wrote:
>>    In my case, the naming space is actually quite small because I want the 
>> IDs to be meaningful but unique.  For example "images:cats:fluffy:XX.png", 
>> where XX can increment or be set randomly until the ID is unique.
> 
> Make XX a random number. Or two or more random numbers - until the 
> statistical likelihood of a collision is small enough that you don't 
> care about checking uniqueness anymore.
> 
> John
> 
> -- 
> John Snelson, Lead Engineer                    http://twitter.com/jpcs
> MarkLogic Corporation                         http://www.marklogic.com
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to