Inconsistency between space used by ZFS snapshots reported by zfs list

From: Miroslav Lachman <000.fbsd_at_quip.cz>
Date: Fri, 02 Aug 2024 21:05:06 UTC
Many times it happened to me that I was looking for where the used space 
in the pool were allocated and I couldn't get the right result. Listing 
"zfs list -o space" lists info that snapshots are taking up the most 
space, but when I list the snapshots for a given filesystem (zfs list -r 
-t snapshot), the sum of the occupied space does not match previously 
reported used size.

# zfs list -o space ssdtank1/vol1/db/postgres
NAME                   AVAIL   USED  USEDSNAP  USEDDS  USEDREFRESERV 
USEDCHILD
ank1/vol1/db/postgres  21.8G   169G      102G   67.0G             0B 
     0B

# zfs list -H -p -r -t snapshot tank1/vol1/db/postgres | awk 'BEGIN { 
used=0 } { used=used+$2 } END { print used/1024/1024/1024"GB" }'
41.9309GB

USEDSNAP from zfs list -o space: 102 G
sum of snapshots sizes: 41.9309 GB

Why it doesn't match?
What is the real space used by snapshots? zfs list -o space or the sum 
of snapshots sizes listed by zfs list -r -t snapshot?

The machine is FreeBSD 13.3-p4 amd64.


Kind regards
Miroslav Lachman