unepwcmc/SAPI — pull request #171 by agnessa (2014-01-15 11:39:23+00:00)
Title: Split listing changes mview

This change simplifies the overnight listing calculation. What happened previously:
1. calculate an intermediate listing_changes_mview for CITES legislation
2. the same for EU legislation
3. the same for CMS legislation
4. UNION the intermediate mviews into listing_changes_mview

The last step was wasteful in that there is not a single query in sapi that would benefit from having listing changes from all designations in one table. What would happen most of the time is any query from listing_changes_mview would have a 'where designation = x' check. Newer code (i.e. Species+ downloads) would take advantage of the intermediate per-designation views and old code could easily do the same.

So as a result I removed step 4 of the overnight script and amended all the remaining places where listing changes mview was queried. That includes:
* Species+ taxon concept serializers
* Species+ & Checklist queries such as search by geo_entity
* Checklist queries for web & downloads, both current and historical
* Checklist timelines

The per-designation views have the same columns & same indexes as the listing_changes_mview, except for multi column indexes where designation was involved, which is no longer needed.