Add option to disable viewing groups filter
Disabling viewing groups will increase the query performance between 30 to 50 times.
Anon-user viewing groups enabled (102.588 ms): https://explain.depesz.com/s/B9oj
Anon-user viewing groups disabled (1.441 ms): https://explain.depesz.com/s/OEDi
User viewing groups enabled (140.476 ms): https://explain.depesz.com/s/81wD
User viewing groups disabled (2.444 ms): https://explain.depesz.com/s/Myxj
Viewing groups can have around 20-50 times performance penalty on job filters.
Add new option
PERMISSION_VIEWING_GROUPS_ENABLED which when
set to False will disable viewing groups filtering.
This might make certain jobs be visible to public. To check that
a new management command has been added.
With an argument
viewing_groups it will show amount of affected
jobs and how many of them are finished.
When viewing groups are disabled submitting a new job with viewing groups will raise a SubmissionException to prevent accidentaly adding a public job. There is a unit test to verify that behavior.