2

I have a database with 20 tables, sometime, i need to delete all the data of database? So, should I delete database and recreate it or just delete all tables (tables have the FKs)?

thangpt
  • 43
  • 2
  • 6

1 Answers1

1

It depends on the size of the database. For larger databases (not sure what size exactly, maybe 100 MB and more), the fastest is to close the database and delete the file.

For smaller databases, the fastest solution might be to truncate all tables, as in TRUNCATE TABLE TEST, but you would need to first disable referential integrity.

Thomas Mueller
  • 48,905
  • 14
  • 116
  • 132
  • 1
    thanks, I have found the solution for my case, I will delete the schema. and all the table inside schema will be deleted too, I don't need to care about the integrity between tables, and the privileges if I delete the file :) – thangpt Apr 18 '12 at 03:12