binda icon indicating copy to clipboard operation
binda copied to clipboard

Please optimize Binda's interface queries

Open a-barbieri opened this issue 7 years ago • 1 comments

On a project with 7 structures (5 for boards and 2 for components) the page load in 18s!

Started GET "/admin_panel/structures/stockist/components/terzo/edit" for ::1 at 2017-09-12 22:36:52 +0200 (2.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Processing by Binda::ComponentsController#edit as HTML Parameters: {"structure_id"=>"stockist", "id"=>"terzo"} Binda::User Load (2.0ms) SELECT "binda_users".* FROM "binda_users" WHERE "binda_users"."id" = $1 ORDER BY "binda_users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]] Binda::Structure Load (1.0ms) SELECT "binda_structures".* FROM "binda_structures" WHERE "binda_structures"."slug" = $1 LIMIT $2 [["slug", "stockist"], ["LIMIT", 1]] Binda::Component Load (0.7ms) SELECT "binda_components".* FROM "binda_components" WHERE "binda_components"."slug" = $1 LIMIT $2 [["slug", "terzo"], ["LIMIT", 1]] Rendering /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/binda/components/edit.html.erb within layouts/binda/application Binda::Structure Load (0.4ms) SELECT "binda_structures".* FROM "binda_structures" WHERE "binda_structures"."id" = $1 LIMIT $2 [["id", 6], ["LIMIT", 1]] Binda::FieldGroup Load (0.8ms) SELECT "binda_field_groups".* FROM "binda_field_groups" WHERE "binda_field_groups"."structure_id" = $1 ORDER BY "binda_field_groups"."position" ASC, "binda_field_groups"."name" ASC [["structure_id", 6]] Binda::FieldSetting Load (0.9ms) SELECT "binda_field_settings".* FROM "binda_field_settings" WHERE "binda_field_settings"."field_group_id" = $1 ORDER BY "binda_field_settings"."position" ASC, "binda_field_settings"."name" ASC [["field_group_id", 8]] Binda::Text Load (0.8ms) SELECT "binda_texts".* FROM "binda_texts" WHERE "binda_texts"."fieldable_id" = $1 AND "binda_texts"."fieldable_type" = $2 AND "binda_texts"."field_setting_id" = $3 LIMIT $4 [["fieldable_id", 8], ["fieldable_type", "Binda::Component"], ["field_setting_id", 32], ["LIMIT", 1]] Binda::Text Load (0.5ms) SELECT "binda_texts".* FROM "binda_texts" WHERE "binda_texts"."fieldable_id" = $1 AND "binda_texts"."fieldable_type" = $2 [["fieldable_id", 8], ["fieldable_type", "Binda::Component"]] (0.9ms) SELECT "binda_field_settings"."slug", "binda_field_settings"."id" FROM "binda_field_settings" Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/binda/fieldable/_form_item_text.html.erb (19.4ms) Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/binda/fieldable/_form_section.html.erb (42.4ms) (0.9ms) SELECT COUNT() FROM "binda_repeaters" WHERE "binda_repeaters"."fieldable_id" = $1 AND "binda_repeaters"."fieldable_type" = $2 AND "binda_repeaters"."field_setting_id" = 38 [["fieldable_id", 8], ["fieldable_type", "Binda::Component"]] Binda::Repeater Load (0.6ms) SELECT "binda_repeaters". FROM "binda_repeaters" WHERE "binda_repeaters"."fieldable_id" = $1 AND "binda_repeaters"."fieldable_type" = $2 AND "binda_repeaters"."field_setting_id" = 38 ORDER BY position [["fieldable_id", 8], ["fieldable_type", "Binda::Component"]] Binda::FieldSetting Load (0.9ms) SELECT "binda_field_settings".* FROM "binda_field_settings" WHERE "binda_field_settings"."id" = $1 LIMIT $2 [["id", 38], ["LIMIT", 1]] Binda::FieldSetting Load (0.7ms) SELECT "binda_field_settings".* FROM "binda_field_settings" WHERE "binda_field_settings"."ancestry" = '38' ORDER BY "binda_field_settings"."position" ASC, "binda_field_settings"."id" ASC Binda::Choice Exists (0.6ms) SELECT 1 AS one FROM "binda_choices" WHERE "binda_choices"."field_setting_id" = $1 LIMIT $2 [["field_setting_id", 39], ["LIMIT", 1]] Binda::Selection Load (0.8ms) SELECT "binda_selections".* FROM "binda_selections" WHERE "binda_selections"."fieldable_id" = $1 AND "binda_selections"."fieldable_type" = $2 AND "binda_selections"."field_setting_id" = $3 LIMIT $4 [["fieldable_id", 18], ["fieldable_type", "Binda::Repeater"], ["field_setting_id", 39], ["LIMIT", 1]] Binda::Choice Exists (1.1ms) SELECT 1 AS one FROM "binda_choices" INNER JOIN "binda_choices_selections" ON "binda_choices"."id" = "binda_choices_selections"."choice_id" WHERE "binda_choices_selections"."selection_id" = $1 LIMIT $2 [["selection_id", 16], ["LIMIT", 1]] Binda::Choice Load (0.9ms) SELECT "binda_choices".* FROM "binda_choices" INNER JOIN "binda_choices_selections" ON "binda_choices"."id" = "binda_choices_selections"."choice_id" WHERE "binda_choices_selections"."selection_id" = $1 ORDER BY "binda_choices"."id" ASC LIMIT $2 [["selection_id", 16], ["LIMIT", 1]] Binda::Choice Load (0.6ms) SELECT "binda_choices".* FROM "binda_choices" WHERE "binda_choices"."field_setting_id" = $1 ORDER BY "binda_choices"."label" ASC [["field_setting_id", 39]] Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/binda/fieldable/_form_item_selections.html.erb (108.8ms) Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/binda/fieldable/_form_section_repeater.html.erb (114.1ms) Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/binda/fieldable/_form_item_repeater.html.erb (140.0ms) Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/binda/fieldable/_form_section.html.erb (162.0ms) Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/binda/fieldable/_form_sidebar.html.erb (113.1ms) Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/binda/fieldable/_form_body.html.erb (481.9ms) Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/binda/components/edit.html.erb within layouts/binda/application (497.1ms) Binda::Board Load (0.7ms) SELECT "binda_boards".* FROM "binda_boards" WHERE "binda_boards"."slug" = $1 LIMIT $2 [["slug", "dashboard"], ["LIMIT", 1]] Binda::String Load (0.8ms) SELECT "binda_texts".* FROM "binda_texts" WHERE "binda_texts"."type" IN ('Binda::String') AND "binda_texts"."fieldable_id" = $1 AND "binda_texts"."fieldable_type" = $2 [["fieldable_id", 4], ["fieldable_type", "Binda::Board"]] Binda::Structure Load (0.5ms) SELECT "binda_structures".* FROM "binda_structures" ORDER BY "binda_structures"."position" ASC Binda::Board Load (0.5ms) SELECT "binda_boards".* FROM "binda_boards" WHERE "binda_boards"."structure_id" = $1 LIMIT $2 [["structure_id", 3], ["LIMIT", 1]] Binda::Board Load (0.5ms) SELECT "binda_boards".* FROM "binda_boards" WHERE "binda_boards"."structure_id" = $1 LIMIT $2 [["structure_id", 5], ["LIMIT", 1]] Binda::Board Load (0.5ms) SELECT "binda_boards".* FROM "binda_boards" WHERE "binda_boards"."structure_id" = $1 LIMIT $2 [["structure_id", 4], ["LIMIT", 1]] Binda::Board Load (0.5ms) SELECT "binda_boards".* FROM "binda_boards" WHERE "binda_boards"."structure_id" = $1 LIMIT $2 [["structure_id", 7], ["LIMIT", 1]] Binda::Board Load (1.3ms) SELECT "binda_boards".* FROM "binda_boards" WHERE "binda_boards"."structure_id" = $1 LIMIT $2 [["structure_id", 8], ["LIMIT", 1]] Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/layouts/binda/_sidebar.html.erb (59.8ms) Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/layouts/binda/_header.html.erb (0.5ms) Rendered /Users/xxxx/.rvm/gems/ruby-2.3.4/gems/binda-0.0.8.pre.alpha.4/app/views/layouts/binda/_flash.html.erb (0.7ms) Completed 200 OK in 19065ms (Views:

a-barbieri avatar Sep 12 '17 20:09 a-barbieri

There is a huge slow down when creating new field settings.

Binda version: 0.1.6.alpha.3

a-barbieri avatar Feb 12 '18 20:02 a-barbieri