title: Why doesn't Django/PostgreSQL reuse primary key values after objects with that primary key have been deleted?
body: <p>I'm trying to figure out why Django (or PostgreSQL, not to sure at which level it is) doesn't reuse primary keys from objects that have been deleted. When objects are created, they all have an id value that is auto incremented and ordered by the id value in the database. For example:</p>
  
  <p>ID      </p>
  
  <p>5        </p>
  
  <p>4</p>
  
  <p>3</p>
  
  <p>2</p>
  
  <p>1</p>
  
  <p>Let's say I happen to delete the object with an ID of 5:</p>
  
  <p>ID      </p>
  
  <p>4</p>
  
  <p>3</p>
  
  <p>2</p>
  
  <p>1</p>
  
  <p>When I create a new object, it has an ID of 6:</p>
  
  <p>ID      </p>
  
  <p>6      </p>
  
  <p>4</p>
  
  <p>3</p>
  
  <p>2</p>
  
  <p>1</p>
  
  <p>Why wasn't "5" assigned as the primary key to the new object I just created? Why does it have 6 instead?</p>