Background: In the old version, the fields latest and live revisions were updated always via two separate dmlDML statements. Every update causes in PostgreSQL (tested to pg 9.6) one more dead tuple, such that on busy systems, we see 30k + dead tuples per hour. These dead tuples in turn cause more auto vacuum operations and can lead to abandoned query plans.
This change can reduce the number of dead tuples on cr_items into half, by allowing both fields to be set in one operation (namely content_item__set_live_revision). This function has an optional 4th argument that can cause this optimization. For legacy applications, nothing changes.
Btw: since all commonly used applications use the live revision, the fallback of the latest_revision is unused. One can consider to remove the cr_revision_latest_tr, at least on on certain installations.
Content-Repository Reform : Reduction of number of functions in the content repository for PostgreSQL by using using argument defaults (while providing compatibility for clients using old versions): - reduced number of versions of content_item__new from 12 (!) to 6 by using defaults - commented differences - commented arguments of plpgsql functions with long argument lists - reduced code duplication by basing one version of content_item__new/17 directly on /20 - marking on version of content_item__new/17 and content_item__new/6 as deprecated
- reduced number of versions of content_revision__new from 7 to 4 by using defaults - commented differences - marking on version of content_revision__new/7 as deprecated - let automatically generated functions call directly content_revision__new/13 - remove space from automatically generated functions - updated automatically generated functions for all types of the content repository
- reduced number of versions of image__new from 4 to 2by using defaults - reduced number of versions of image__new_revision from 2 to 1 by using defaults