my.tar.gz is a gzipped tar file. tar ist short for 'tape archive'.
So the file
my.tar.gz has to be unzipped by
gzip -d before the tar file can be read.
There is no random access to the content of a gzip file. I do not really know the gzip file format but at least there is no option for
gzip to do this. The 'gzip -d' started by
tar to unzip the
my.tar.gz file is the
gzip you can see.
tar does not decompress the file
huge_mysql_file.gz but it has to read (and ignore) the file
huge_mysql_file.gz because this is provided by the pipe to gunzip.
if the tar file is not gzipped and you list its content like in
tar -tvf my.tar --exclude="huge_mysql_file.gz"
only the header of
huge_mysql_file.gz in the archive must be read to know its size. Then tar can skip the file without reading it and continue on the following file.