Ordering by field, constructed by subquery is slow
Try to flatten the subquery into a join:

SELECT *
FROM (SELECT d.*,
             max(r.date) AS register_date
      FROM documents AS d
      LEFT JOIN registrations AS r
          ON r.document_id = d.id
      GROUP BY d.id) AS my_documents_view
ORDER BY register_date desc NULLS LAST
LIMIT 20;