Deleting Unnecessary SQL files from tables
Comments
-
Hi,
****IMPORTANT: Backup your database before running these queries.****
Here are some general cleanup scripts that can be run to cleanup unnecessary data in your Decisions SQL tables. Before making any significant changes I do advise that you take a backup as an extra precaution.
Orphan Data Cleanup:
delete from document_dbstorage where document_storage_id not in (select document__storage_id from document)
delete from document_thumbnail_dbstorage where document_thumbnail_storage_id not in (select doc_thumbnail_storage_id from document where doc_thumbnail_storage_id is not null)
delete from element_configuration_data where element_configuration_data.component_config_data_id not in
(select component_registration_data_id from element_registration where component_registration_data_id is not null)delete from element_registration_data_join where component_registration_id not in (select component_registration_id from element_registration)
delete from output_scenario where component_registration_id not in
(select component_registration_id from element_registration)delete from output_scenario_data_join where output_scenario_id not in
(select output_scenario_id from output_scenario)delete from data_declaration where data_declaration_id not in
(
select data_declaration_id from element_registration_data_join where component_registration_id in (select component_registration_id from element_registration)
)
and data_declaration_id not in
(
select data_declaration_id from output_scenario_data_join where output_scenario_id in (select output_scenario_id from output_scenario)
)delete from flow_state_storage_data where deleted = 1
delete from flow_data_delta_storage where flow_data_delta_storage.primary_flow_tracking_id not in
(select primary_flow_tracking_id from flow_state_storage_data)delete from flow_step_run_data
delete from job_schedule_log where when_completed is not null and ended_in_error = 0
-If you have turned on Auditing Settings or Client Statisics Settings, youll also want to run the following scripts.
--delete from audit_entity
--delete from client_statistic_summary
--delete from client_statisticAssignment Cleanup:
update entity_assignment set completed = 1, next_check_time = null, state = FLOW NOT FOUND where completed = 0 and flow_tracking_id is not null and flow_tracking_id not in (select flow_tracking_id from flow_state_storage_data where (deleted = 0 or deleted is null) and (completed = 0 or completed is null) and (ended_in_exception = 0 or ended_in_exception is null))
[i]edited by Brendan@decisions.com on 12/6/2019[/i]
[i]edited by mike.marushia@decisions.com on 12/6/2019[/i]
Howdy, Stranger!
Categories
- 2.1K All Categories
- 18 General
- 155 Installation / Setup
- 991 Flows
- 86 Rules
- 203 Administration
- 204 Portal
- 433 General Q & A
- 600 Forms
- 282 Reports
- 3 Designer Extensions
- 38 Example Flows
- 32 CSS Examples
- 1 Diagram Tile
- 5 Javascript Controls
- 139 Pages
- 1 Process Mining
- New Features
- 150 Datastructures
- 50 Repository
- 169 Integrations
- 25 Multi-Tenant
- 21 SDK
- 40 Modules
- 38 Settings
- 20 Active Directory
- 12 Version 7
- 34 Version 8