From 5056f399c4ef6e2d011ddcde88d30b0629469db5 Mon Sep 17 00:00:00 2001 From: iuwqyir Date: Tue, 3 Dec 2024 20:48:35 +0200 Subject: [PATCH] use lightweight deletes --- internal/storage/clickhouse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/storage/clickhouse.go b/internal/storage/clickhouse.go index 7083d1c..6357974 100644 --- a/internal/storage/clickhouse.go +++ b/internal/storage/clickhouse.go @@ -1003,7 +1003,7 @@ func (c *ClickHouseConnector) DeleteBlockData(chainId *big.Int, blockNumbers []* } func (c *ClickHouseConnector) deleteBatch(chainId *big.Int, blockNumbers []*big.Int, table string, blockNumberColumn string) error { - query := fmt.Sprintf("ALTER TABLE %s.%s DELETE WHERE chain_id = ? AND %s IN (?)", c.cfg.Database, table, blockNumberColumn) + query := fmt.Sprintf("DELETE FROM %s.%s WHERE chain_id = ? AND %s IN (?)", c.cfg.Database, table, blockNumberColumn) blockNumbersStr := make([]string, len(blockNumbers)) for i, bn := range blockNumbers {