diff --git a/satellite/satellitedb/storagenodeaccounting.go b/satellite/satellitedb/storagenodeaccounting.go index 17300f76f..2e7ffe43f 100644 --- a/satellite/satellitedb/storagenodeaccounting.go +++ b/satellite/satellitedb/storagenodeaccounting.go @@ -286,22 +286,22 @@ func (db *StoragenodeAccounting) QueryStorageNodeUsage(ctx context.Context, node start, end = start.UTC(), end.UTC() query := ` - SELECT at_rest_total, start_time::date + SELECT at_rest_total, (start_time at time zone 'UTC')::date as start_time FROM accounting_rollups WHERE node_id = $1 AND $2 <= start_time AND start_time <= $3 UNION - SELECT SUM(data_total) AS at_rest_total, interval_end_time::date AS start_time + SELECT SUM(data_total) AS at_rest_total, (interval_end_time at time zone 'UTC')::date AS start_time FROM storagenode_storage_tallies WHERE node_id = $1 AND NOT EXISTS ( SELECT 1 FROM accounting_rollups WHERE node_id = $1 AND $2 <= start_time AND start_time <= $3 - AND start_time::date = interval_end_time::date + AND (start_time at time zone 'UTC')::date = (interval_end_time at time zone 'UTC')::date ) AND (SELECT value FROM accounting_timestamps WHERE name = $4) < interval_end_time AND interval_end_time <= $3 - GROUP BY interval_end_time::date + GROUP BY (interval_end_time at time zone 'UTC')::date ORDER BY start_time; `