Delete data permanently from dbf lazarus / 16-Databases ---------------------------------------------------------------------- catosp · 2011-09-13 07:50 Hello everyone... I have a problem : -  i have a dbf file and i want to delete permanently data from this. I use command : "Dbf1.Delete" but it is not enough because this comand just make a logical delete ...data still remain in databse, and my dbf file grow up in size. How can i make a permanently delete ? Pls help me! Thank you in advance ! PS: sorry for bad english ---------------------------------------------------------------------- marcov · 2011-09-13 08:05 Quote from: catosp on September 13, 2011, 09:50:04 amHello everyone... I have a problem : -  i have a dbf file and i want to delete permanently data from this. I use command : "Dbf1.Delete" but it is not enough because this comand just make a logical delete ...data still remain in databse, and my dbf file grow up in size. How can i make a permanently delete ? Pls help me! Thank you in advance ! PS: sorry for bad english Afaik this is normal. The idea is that records are only marked deleted is mostly for performance reasons. You need to run a pack or purge command or so to remove deleted records, and it is recommended to do that only once in a while since it can take some time. ---------------------------------------------------------------------- catosp · 2011-09-13 08:15 Aaaaa.....okkkk thank you verry much....I believe the corect code is : Dbf1.Delete; Dbf1.PackTable; Is corect ? ---------------------------------------------------------------------- McCorder · 2011-09-16 18:19 This is correct however it will get slower and slower if your DBF file is growing, and it requires exclusive access. ---------------------------------------------------------------------- TurboRascal · 2011-09-16 22:00 You should not pack the table on every delete; when the database grows, it will slow to a crawl and drive your users insane... Packing the table means rewriting the whole DBF! That's not something you wish to happen often, and it is actually one of database maintenance operations. If you want to purge deleted records, I'd recommend you to make it only periodically, I'd for example do it at application start or shutdown (and create a backup copy while at it), or at most to be executed when some  long batch operations are done... ---------------------------------------------------------------------- catosp · 2011-09-17 07:03 ok..i understand...i think the best method to do this is when the  program is start up or to atach this command to a button.