'what does rake db:schema:cache:dump exactly do? is it safe to be ran in production?
Rails has an issue with big schemas where it becomes slower over time as the app grows, to fix this issue the schema_cache file was introduced and is enabled by default, it get updated with every migration.
We can create and update the file manually using rake db:schema:cache:dump.
Finally my questions:
- What query does it actually run inside the db?
- Does it lock the db while performing the query?
- Finally is it safe to be ran in production?
Thank you
Solution 1:[1]
The command can be executed in production and it creates a db/schema_cache.yml. Mainly it serializes data related to schema into this file. Generally in a prod environment with multiple servers, this file would be shared across to avoid db calls for
show full fields
This query is run by rails framework on boot of servers and with this file the requests would decline and the yml file would serve this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Bijendra |
