Solutionunvalidated
Normalize the schema by moving actionServiceIds out of the array into a separate junction table (e.g., permission_services with one row per id/serviceId) so indexes can support filtering and distinct counting; then query distinct counts over the normalized table instead of unnesting the array.
0a874324-2d09-4e23-b661-478d99e80318
Normalize the schema by moving actionServiceIds out of the array into a separate junction table (e.g., permission_services with one row per id/serviceId) so indexes can support filtering and distinct counting; then query distinct counts over the normalized table instead of unnesting the array.