Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9200377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:45:14+00:00 2026-06-17T22:45:14+00:00

My question is – does Dataomic require the explicit manual creation of unique sequence

  • 0

My question is – does Dataomic require the explicit manual creation of unique sequence numbers by the end user? Or is it just the example provided?

I’m reading through the Datomic tutorial.

When I look at the data that gets loaded in seattle-data0.dtm I see on the first two lines:

[
{:district/region :region/e, :db/id #db/id[:db.part/user -1000001], :district/name "East"}
{:db/id #db/id[:db.part/user -1000002], :neighborhood/name "Capitol Hill", :neighborhood/district #db/id[:db.part/user -1000001]}

Notice in particular the values

:db/id #db/id[:db.part/user -1000001],
:db/id #db/id[:db.part/user -1000002]
#db/id[:db.part/user -1000001]

Perhaps you can help me understand – this appears to explicitly require a manually generated unique ID sequence number when preparing data for insert.

Surely in a modern database we can rely on the database to generate sequence numbers for us?

When I go to do my own example schema and data insert – I find that I am required to insert manual ID numbers as well. What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:45:15+00:00Added an answer on June 17, 2026 at 10:45 pm

    To answer your question: No Datomic doesn’t require the end user to generate identifiers. What you see in the seattle example are temporary ids.

    Every time you want to add some facts about new entities to Datomic, you have to give every new entity a temporary id. This id will be replaced with a real unique id by Datomic.

    Now you may ask yourself why do you have to use this temporary ids in the first place? Temporary ids are needed to express relationships between all new entities in one single transaction. In your example, you have the ids:

    :db/id #db/id[:db.part/user -1000001],
    :db/id #db/id[:db.part/user -1000002]
    #db/id[:db.part/user -1000001]
    

    two of them are the same (I’ll explain the negative numbers in a moment). That means that the new entity marked with the temporary id #db/id[:db.part/user -1000001] is the same in both assertions.

    Now I have to explain the data literal (other link) #db/id[:db.part/user -1000001]. #db/id is the tag for a Datomic temporary id. The tag is followed by a vector of two components :db.part/user and -1000001. The first part is the database partition and is mandatory. The second part is optional. If you write just #db/id[:db.part/user], you get a fresh (different) temporary id every time this literal occurs. If you write #db/id[:db.part/user -1000001] you get the same temporary id every time you use the negative index -1000001. So #db/id[:db.part/user -1000001] is different to #db/id[:db.part/user -1000002].

    I don’t exactly know why the examples use indices below 1000000. The JavaDoc of tempid where the data literal of #db/id resolves to, says, that the numbers from -1 (inclusive) to -1000000 (exclusive) are reserved for user-created temp ids. So maybe someone can shed some light on this.

    To sum this up: #db/id[...] are temporary ids to express same entities in one transaction and are replaced by real unique ids by Datomic at the end of the transaction. If you don’t have to refer to the same entity in a transaction twice, you are fine with just #db/id[:db.part/user] for every temporary id.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question How can I get this sequence to fire when a user takes action
Question: I receive the following error for the code below, does anyone know why?
Question: I have just wrote my first code using c# lambda expressions. It works,
Question: Where is the default browser on Android 4 derived from ? The user-agent
Question: Have I got this example backwards? Is the reason to return Interface so
Question Does anyone know why there is no GROUP BY optimization for MyISAM-based tables?
Question: Is there a way to make view PERSON for user jack point to
Question is, how to add validation for unique username? i can simply check it
Question Is it possible to stop a Message Driven Bean (programmatically), so that it
Question context: let say that there is some really important row in config/locales/en.yml that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.