Merge pull request #16014 from CartoDB/feature/ch123224/levinscott-very-slow-dashboard-loading

[ch123224] Optimize dashboard loading when the number of datasets is very large
pull/16030/head
Shylpx 4 years ago committed by GitHub
commit e1d538749a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -39,6 +39,7 @@ sudo make install
- Bump version of lib/sql submodule to 0.37.1
- Public profile can be disabled via Feature Flag [#15982](https://github.com/CartoDB/cartodb/pull/15995)
- Migrate Organization CRUD to MessageBroker [#15934](https://github.com/CartoDB/cartodb/pull/15934)
- Optimize dashboard loading when the number of datasets is very large [#16014](https://github.com/CartoDB/cartodb/pull/16014)
4.44.0 (2020-11-20)
-------------------

@ -98,11 +98,10 @@ module Carto
unless (params[:subscribed] == 'true' and not v.subscription.present?) or (params[:sample] == 'true' and not v.sample.present?)
end.compact
total_subscriptions = 0
vqb.filtered_query.find_each{|v| total_subscriptions += 1 if v.subscription.present?}
total_samples = 0
vqb.filtered_query.find_each{|v| total_samples += 1 if v.sample.present?}
total_subscriptions = vqb.filtered_query.includes(map: { user_table: :data_import })
.find_each.lazy.count { |v| v.subscription.present? }
total_samples = vqb.filtered_query.includes(map: { user_table: :data_import })
.find_each.lazy.count { |v| v.sample.present? }
total_entries = vqb.count
total_entries = total_subscriptions if params[:subscribed] == 'true'

@ -667,18 +667,18 @@ class Carto::Visualization < ActiveRecord::Base
end
def subscription
table_name = (user_table.name if user_table) || (related_tables[0].name if related_tables && related_tables[0])
@subscription ||= if table_name
table = user_table || related_tables.try(:first)
@subscription ||= if table
doss = Carto::DoSyncServiceFactory.get_for_user(user)
doss&.subscription_from_sync_table(table_name)
doss&.subscription_from_sync_table(table)
end
end
def sample
table_name = (user_table.name if user_table) || (related_tables[0].name if related_tables && related_tables[0])
@sample ||= if table_name
table = user_table || related_tables.try(:first)
@sample ||= if table
doss = Carto::DoSampleServiceFactory.get_for_user(user)
doss&.dataset_from_sample_table(table_name)
doss&.dataset_from_sample_table(table)
end
end

Loading…
Cancel
Save