Purge Menu Data

From DOC

Jump to: navigation, search

Menu Data can be deleted, however, due to referential integrity constraints, the actual mechanism used at runtime is to set an irreversible "deleted" flag:

md.setDeleted(true);

All queries against MenuData ignore rows with the deleted flag set. This flag can also be used to clean up later:

DELETE FROM app.menu_data_attach WHERE menudata_id IN (SELECT id FROM app.menu_data WHERE deleted=true);
DELETE FROM app.menu_data_word WHERE menudata_id IN (SELECT id FROM app.menu_data WHERE deleted=true);
DELETE FROM app.placeholder_id WHERE placeholder_id IN (SELECT id FROM app.menu_data WHERE deleted=true);
DELETE FROM app.menu_data WHERE deleted=true;

A sql file is located at [install-dir]/operation/postgreSQL/purgeMenuData.sql

This is not a particularly fast operation - the tables are not (and should not be) tuned for this cleanup. Therefore, the script should be run infrequently and in off-peak times. If using PostgreSQL, follow this with a "vacuum" to reclaim space.

Personal tools