Commit 1900a88
committed
Clean db indexes
- Swap wrong index names `history_decoded_not_proc_idx` and `history_decoded_processed_idx`
- Remove not used indexes
The following indexes have been identified as unused (0 scans) and are being removed to reduce database size:
| Index Name | Mainnet DB Size | Polygon DB Size | Usage Status | Justification |
|------------|----------------|-----------------|--------------|---------------|
| `history_ethereumtx_to_9fb37c13` | 1588 MB | 9893 MB | 0 scans | Unused - no queries filter by `to` field |
| `history_ethereumtx__from_e36d4662` | 1758 MB | 8707 MB | 0 scans | Unused - no queries filter by `_from` field |
| `history_ethereumtx_status_d1d0de2c` | 1074 MB | 6645 MB | 0 scans | Unused - no queries filter by `status` field |
| `history_internaltxdecoded_function_name_333ae03e` | 519 MB | 3204 MB | 0 scans (DB1) / 69K scans (DB2) | Replaced by dedicated `history_decoded_setup_idx` for `function_name="setup"` queries |
| `history_internaltxdecoded_function_name_333ae03e_like` | 519 MB | 3205 MB | 0 scans | Unused - no LIKE queries on `function_name` |
| `history_multisigtransaction_failed_4842ad6b` | 43 MB | N/A | 0 scans | Unused - field is used but index is not needed |
| `history_decoded_setup_idx` | 13 MB | 194 MB | 0 scans (DB1) / 62K scans (DB2) | **KEEPING** - Used in DB2, will monitor DB1 |
| `history_safe_banned_idx` | 8 KB | N/A | 0 scans | Unused - no queries filter by `banned=True` |
**Total Potential Savings:**
- Database 1: ~5.5 GB
- Database 2: ~28.5 GB
**Note:** The `function_name` indexes are being removed because:
- The dedicated `history_decoded_setup_idx` (partial index on `safe_address` WHERE `function_name="setup"`) covers the only production query that filters by `function_name`
- Admin interface filtering does not require these indexes for performance
- All other `function_name` queries are in tests or already-executed migrations1 parent b89b695 commit 1900a88
File tree
2 files changed
+58
-6
lines changed- safe_transaction_service/history
- migrations
2 files changed
+58
-6
lines changedLines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
| 431 | + | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
| 435 | + | |
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
| 442 | + | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| |||
1360 | 1360 | | |
1361 | 1361 | | |
1362 | 1362 | | |
1363 | | - | |
| 1363 | + | |
1364 | 1364 | | |
1365 | 1365 | | |
1366 | 1366 | | |
| |||
1370 | 1370 | | |
1371 | 1371 | | |
1372 | 1372 | | |
1373 | | - | |
| 1373 | + | |
1374 | 1374 | | |
1375 | 1375 | | |
1376 | 1376 | | |
1377 | 1377 | | |
1378 | | - | |
| 1378 | + | |
1379 | 1379 | | |
1380 | 1380 | | |
1381 | 1381 | | |
| |||
0 commit comments