Why is SQLite adding unused disk space to “free-list” after deleting a lot of data in a database?

dba.stackexchange https://dba.stackexchange.com/questions/24519

  •  30-10-2019
  •  | 
  •  

Pergunta

The SQLite FAQ states the following:

(12) I deleted a lot of data but the database file did not get any smaller. Is this a bug?

No. When you delete information from an SQLite database, the unused disk space is added to an internal "free-list" and is reused the next time you insert data. The disk space is not lost. But neither is it returned to the operating system.

Can you explain to me the motives behind that decision (as opposite to returning free space to the OS immediately)? What are the pros and cons of such decision (including non-obvious ones)?

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a dba.stackexchange
scroll top