For PostgresQL:
SELECT count(distinct array[DocumentId, DocumentSessionId]) FROM DocumentOutputItems;