The approach works. If subquery generate lot of records, array_agg() needs to accumulate them.
Are you consider the following approaches.
At the end of the SELECT query metrics has resultCount can you utilize that? (If Pagination queries may terminate early and may not reflect actual values.)
Two different queries (count query, actual results)
The following approach and check which performs better
SELECT ARRAY_COUNT(res) AS count, res AS results
LET res = (SELECT p.ID, p.Name FROM Preferences p WHERE type = “myType”);