WIP: Enable caching of schema.rb
What does this MR do?
This enables the caching of schema information as described in http://iempire.ru/2016/12/13/schema-cache/. This means Rails doesn't have to check the schema when booting up. This in turn means we don't have to run expensive queries such as:
SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"milestones"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum;
Such a query can easily take 200 milliseconds on GitLab.com.
Further I observed a reduction of boot timings locally of around 3 seconds, but this may differ per environment.
This was brought to our attention by @stanhu in the #database
channel so he really deserves the credit for this.
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated - Review
-
Has been reviewed by Backend -
Has been reviewed by Database
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Squashed related commits together