From 167b9b81440017f5253efda4bb6566d12f0eedc8 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 24 Aug 2017 14:35:21 +0200 Subject: Enable caching of schema.rb This is a lesser known Rails feature that removes the need for querying various internal tables for schema details (e.g. column types) every time Rails boots up. This feature is described in http://iempire.ru/2016/12/13/schema-cache/ and was brought to our attention by @stanhu. Since the schema cache is specific to the database we only enable this on PostgreSQL. --- config/application.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'config/application.rb') diff --git a/config/application.rb b/config/application.rb index f69dab4de39..68dc449b793 100644 --- a/config/application.rb +++ b/config/application.rb @@ -10,6 +10,7 @@ module Gitlab require_dependency Rails.root.join('lib/gitlab/redis/queues') require_dependency Rails.root.join('lib/gitlab/redis/shared_state') require_dependency Rails.root.join('lib/gitlab/request_context') + require_dependency Rails.root.join('lib/gitlab/database') # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers @@ -156,6 +157,10 @@ module Gitlab config.active_record.raise_in_transactional_callbacks = true + # The schema cache is database specific. There is no way to support both + # PostgreSQL and MySQL, hence we only enable this when PostgreSQL is used. + config.active_record.use_schema_cache_dump = Gitlab::Database.postgresql? + config.active_job.queue_adapter = :sidekiq # This is needed for gitlab-shell -- cgit v1.2.1