diff --git a/stores/metadata.go b/stores/metadata.go index c2e07ed00..aae62073d 100644 --- a/stores/metadata.go +++ b/stores/metadata.go @@ -641,8 +641,9 @@ func (s *SQLStore) ObjectsStats(ctx context.Context, opts api.ObjectsStatsOpts) var totalSectors int64 err = s.db. - Model(&dbSector{}). - Count(&totalSectors).Error + Model(&dbSlab{}). + Select("COALESCE(SUM(total_shards), 0)"). + Scan(&totalSectors).Error if err != nil { return api.ObjectsStatsResponse{}, err }