Avoiding a sort on an already clustered index for group by
As you have no WHERE clause, you (the query, that is) must scan the whole table to be able to compute the aggregate.  Once it has all the data, it is much easier to sort them directly than to go to an index and match the rows and return them in order.  This latter would involve further I/O which is slow compared to operation in the memory.

If you were on PostgreSQL 9.2 (or above) and you had an index on (pid, did) then the optimizer might have chosen an index scan instead.