PERF: stop running VACUUM FULL only run VACUUM

This commit is contained in:
Sam 2015-12-07 20:14:26 +11:00
parent c04bcf8655
commit 8d49091572
3 changed files with 13 additions and 4 deletions

View File

@ -83,7 +83,16 @@ const CloakedCollectionView = Ember.CollectionView.extend({
const mid = Math.floor((min + max) / 2),
// in case of not full-window scrolling
$view = childViews[mid].$(),
viewBottom = $view.position().top + wrapperTop + $view.height();
// .position is quite expensive, shortcut here to get a slightly rougher
// but much faster value
parentOffsetTop = $view.offsetParent().offset().top,
offsetTop = $view.offset().top,
viewBottom = (offsetTop - parentOffsetTop) + wrapperTop + $view.height();
console.log(viewBottom);
if (viewBottom > viewportTop) {
max = mid-1;

View File

@ -1185,7 +1185,7 @@ en:
delete_drafts_older_than_n_days: Delete drafts older than (n) days.
vacuum_db_days: "Run VACUUM FULL ANALYZE to reclaim DB space after migrations (set to 0 to disable)"
vacuum_db_days: "Run VACUUM ANALYZE to reclaim DB space after migrations (set to 0 to disable)"
prevent_anons_from_downloading_files: "Prevent anonymous users from downloading attachments. WARNING: this will prevent any non-image site assets posted as attachments from working."

View File

@ -11,12 +11,12 @@ task 'db:migrate' => ['environment', 'set_locale'] do
if SiteSetting.vacuum_db_days > 0 &&
SiteSetting.last_vacuum < (Time.now.to_i - SiteSetting.vacuum_db_days.days.to_i)
puts "Running VACUUM FULL ANALYZE to reclaim DB space, this may take a while"
puts "Running VACUUM ANALYZE to reclaim DB space, this may take a while"
puts "Set to run every #{SiteSetting.vacuum_db_days} days (search for vacuum in site settings)"
puts "#{Time.now} starting..."
begin
Topic.exec_sql("VACUUM FULL ANALYZE")
Topic.exec_sql("VACUUM ANALYZE")
rescue => e
puts "VACUUM failed, skipping"
puts e.to_s