Content view versions list has slow query for package count
Customer has over 9 million rows in their katello_repository_rpms. Checking for content view version list takes much longer than anticipated.
We need to cache to the content counts for a content view version when creating it and have content view version list piggy back of that cache.
We could add a counts with a serializable json to store this information.
Four parts to the story
1) Create a serializable column to store the content counts for a content view version
2) Store the content view counts when the content view is created
3) Make the content view version list use the content counts
4) Write a db migration script to setup the content counts
Content view versions list api ran a count query for every content type
belonging to a content view. This means atleast 10 queries for each
content type and can get out of hand when one is returning over 40
versions in a list api call
This commit addresses the above issue by storing the counts in a
serializable hash for each content view version on every publish and
that cached result is returned when content_counts is called.
This should result in a speed up in the api response