1

How are node IDs generated? Is there a field in the database, like "last node ID", that's incremented each time a new node is created? What is the data type, and are there limitations, such as a maximum value?

1
  • 2
    That question makes me wonder why you need to know the last node NID. Often (not always) when that type of question comes up it is a result of wanting to do something where you think you need to know the last NID but actually there may be a better way to do what you want to do.
    – rooby
    Dec 18, 2014 at 23:00

1 Answer 1

3

{nid} is an auto_increment field in the table {node} - As all of the nodes are sourced from that one table it's able to keep its serialization. This is part of why UUID is such an important initiative in Drupal 8. It's not straightforward to maintain portability of content across environments for this reason.

The type is int(10) also known as unsigned so you're only limited by the data type limit of your preferred database and the disk space on your database server to store all those nodes. If it's MySQL that's 0 up to 4294967295.

1
  • +1. @audiomason, you might want to read up on auto incrementing fields for your DBMS. It is for instance possible to reset the field. Dec 19, 2014 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.