![]() ![]() This means that if you want to remove all data from the table use: DELETE FROM The deleted data is not saved to the logs. ![]() But on the other hand, there is also no operation log as in “big SQL engines”. This is why I’m using truncate to deal with not important data So, how to truncate in SQLite? So, if the delete is safer, why would I use truncate? Mostly for the sake of performance – the delete operation takes longer, especially if there is serious amount of data to remove. On the other hand, truncate removes the data and in the logs, there is only the information that such an operation took place. In case of any issue, the operation can be reverted by the engine. What is the difference between truncate and delete? In the databases such as MySQL, Postgres or Oracle, the delete operation saves all of the removed data to the logs. ![]() Surprisingly there is no truncate statement in the SQLite. In most cases, however, I only want to get rid of data but leave the empty table in place. Of course, if the table is no longer needed, I can delete the whole table. In the typical engine such as MySQL or Postgres, once the data is not needed anymore I use truncate to remove the data from the table. In some of my projects, the database tables are getting bigger and bigger. What is most important for me – it is easy to use and it only takes a file copy to perform the database backup. The database engine is fast, small and serves well for small amounts of data. For my pet projects, I’m using SQLite a lot. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |