1. Connect to Postgres PSQL console. Example for default installation:
`psql -U postgres -h localhost -d thingsboard`
2. Truncate event tables:
```
truncate lc_event;
truncate rule_chain_debug_event;
truncate rule_node_debug_event;
truncate stats_event;
truncate integration_debug_event;
truncate converter_debug_event;
truncate error_event;
truncate raw_data_event;
```
3. Drop tables that act as partitions:
a. Disable PSQL pager so it is easier to copy-paste:
`\pset pager 0`
b. Use this command to get the list as such:
```
SELECT concat('DROP TABLE ',TABLE_NAME,';') as data FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '%_event_1%';
```
You should get something like this in the output:
```
data
-------------------------------------------------
DROP TABLE rule_node_debug_event_1671552000000;
DROP TABLE rule_node_debug_event_1671616800000;
DROP TABLE rule_node_debug_event_1671624000000;
DROP TABLE error_event_1641427200000;
DROP TABLE lc_event_1641427200000;
DROP TABLE lc_event_1642636800000;
DROP TABLE lc_event_1644451200000;
DROP TABLE lc_event_1643846400000;
DROP TABLE lc_event_1645056000000;
DROP TABLE lc_event_1647475200000;
DROP TABLE stats_event_1671667200000;
(11 rows)
```
c. Copy and paste all listed commands. For example:
```
DROP TABLE rule_node_debug_event_1671552000000;
DROP TABLE rule_node_debug_event_1671616800000;
DROP TABLE rule_node_debug_event_1671624000000;
DROP TABLE error_event_1641427200000;
DROP TABLE lc_event_1641427200000;
DROP TABLE lc_event_1642636800000;
DROP TABLE lc_event_1644451200000;
DROP TABLE lc_event_1643846400000;
DROP TABLE lc_event_1645056000000;
DROP TABLE lc_event_1647475200000;
DROP TABLE stats_event_1671667200000;
```