> I have deleted some objects in my database. Now I have objects at id > (INTEGER PRIMARY KEY) =1,3,4,5,7,8,9,16,17,20.... . > id=2,6,10,.. are empty. I want to defrag the database so that I have objects > continuously at id=1,2,3,4,5,6,7,...
The first question I'd have to ask is why you want to do that? If those primary keys are referred to by foreign keys in child tables, you'd have to change all those values as well. With a large number of child tables, this seems like more work than it's work. Any mistakes and you destroy your database's referential integrity. > Is the vacuum function not the right function? I don't believe so. I think your only recourse is to define another table with the same structure, then select all the records from the old one into the new one, delete the old one, then do the same back again to the old name. Unless there's some pragma or something that allows one to rename a table.