We've had the case where a seemingly small change in a query (such as adding a .join()
clause) actually caused us a large load-related headache when run multiple times by our users in production. To avoid this issue in future iterations we now use (rack-mini-profiler)[https://github.com/MiniProfiler/rack-mini-profiler] to help us measure our queries in development! The profiler will give you a file-by-file, query-by-query analysis of your page load times and flag expensive queries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
# This file includes several tasks to help with the management of the audited gem. The two main tasks are: | |
# | |
# yaml_to_jsonb - this will migrate yaml data stored in a column named audited_changes_yaml to jsonb data stored | |
# in a column named audited_changes. | |
# | |
# scrub - this will look at all of the columns that have been excluded from audited classes and ensure that | |
# they are all removed from the jsonb data. | |
# |