Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-465

Produce sequential, but unique, document id's

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.11
    • Component/s: None
    • Labels:
      None

      Description

      Currently, if the client does not specify an id (POST'ing a single document or using _bulk_docs) a random 16 byte value is created. This kind of key is particularly brutal on b+tree updates and the append-only nature of couchdb files.

      Attached is a patch to change this to a two-part identifier. The first part is a random 12 byte value and the remainder is a counter. The random prefix is rerandomized when the counter reaches its maximum. The rollover in the patch is at 16 million but can obviously be changed. The upshot is that the b+tree is updated in a better fashion, which should lead to performance benefits.

        Attachments

        1. uuid_generator.patch
          5 kB
          Robert Newson
        2. couch_uuids.patch
          18 kB
          Paul Joseph Davis
        3. 041-uuid-gen-utc.ini
          0.0 kB
          Bob Dionne
        4. 041-uuid-gen-seq.ini
          0.0 kB
          Bob Dionne
        5. 041-uuid-gen.t
          4 kB
          Bob Dionne

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rnewson Robert Newson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: