I have been looking in vain, in Postfix documentation and otherwise, to understand the difference in output between the mailq command and qshape. (The underlying problem is slow mail delivery.)

Counting the mails in the mail queue (output of mailq command, or rather looking in subfolders of /var/spool/postfix/)

maildrop 0
incoming 0
active 4644
defer 707
deferred 698

I would have expected the qshape command to come up with figures somewhat resembling this but it says (when issuing qshape with no options, i.e. active + incoming):

# qshape
                                         T  5 10 20 40 80 160 320 640 1280 1280+
                                  TOTAL 32  0  2  0 10  4   8   8   0    0     0
                           mydomain1com 30  0  2  0  8  4   8   8   0    0     0
                          mydomain2.net  2  0  0  0  2  0   0   0   0    0     0

So this resembles the picture of a "healthy queue" according to the qshape documentation.

But doesn't this tell me there are only 32 mails in the active queue, while the mailq command shows 4644 at the same time? What is this difference all about?

Or is that difference something of diagnostic value?

As I understand it, the mails in the active queue are the ones Postfix is trying to deliver in the moment. If there are 4644 mails in that active queue there has to be a lot of "suspended" wait for SMTP connections (i.e. no actual errors such as "domain found" etc) - is that correct or does that have another meaning?


As barely reading through qshape code (it's based on Perl), this tool is independent from mailq command. It works by

  1. Directly scan the content of queue_directory (/var/spool/postfix/ in your case)
  2. Sanity check the content of file by parsing the queue file. See the code on github, especially on line 219-270 (sorry, I don't quite understand Perl)

So in your case, maybe the queue file doesn't pass the sanity checks no. 2.

If you interest, you better post this problem on postfix mailing list postfix-users@postfix.org . The qshape author (Victor Duchovni) is an active member of that list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.