Clean up pieceinfo.db


I still have a pieceinfo.db with over 500MB, so I checked what’s using so much space. It’s mostly filled with stefan-benten pieces…

When I try to delete these rows I’m getting “no such table: main.certificate”. Apparently there’s an invalid foreign key (not just for the stefan-benten sat, but for all).

So… is pieceinfo.db still being used, and if so, how can I clean it up?


You may try to re-create it:

Thanks, however the database itself is not malformed; if I just re-create it, it’ll be empty and all records of all sats are gone (including the productive ones).

Maybe someone with an older node can check if he also still has pieces of decomissioned sats in pieceinfo.db? And if so - is it possible to delete those rows?

It’s possible to delete this data, it is just not simple.

  1. Make a backup copy of the database
  2. Take a database schema sqlite3 pieceinfo.db ".schema"
  3. Create a temporary copy of this table, but without FK
  4. Insert there only valid data
  5. Drop the source table
  6. Create it back and insert all data from a temporary table
  7. Drop the temporary table

However, in my case this table is empty, because this info was migrated to the pieces itself several years ago, the same for orders.db, because they are migrated to the orders folder near the config.yaml file.
So, I believe it would be simpler just recreate the database in question.


Wouldn’t it be more simple to just delete all the unwanted dbs and reclaim the space. My orders.db is 411MB. If there is any future use by devs then it can be recreated than relying on SNOs.

No. There are migrations. There are several not used databases, but we cannot easily drop them because of migrations and some links in the code.
Seems your node somehow missed some migrations or there was problems during applying.

1 Like

Shouldn’t subsequent migrations fix that issue ? This is just waste of space :frowning:

Usually not. One migration for the time and sequence is important. As I said, you may re-create this database.

1 Like

Do we have to do this with the two satellites that are now shutting down? Or will the database be cleaned?

This database should be already cleaned up during migration.