Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New FindAProject page performance problems #4129

Open
benwbrum opened this issue May 27, 2024 · 2 comments · May be fixed by #4142
Open

New FindAProject page performance problems #4129

benwbrum opened this issue May 27, 2024 · 2 comments · May be fixed by #4142
Assignees

Comments

@benwbrum
Copy link
Owner

The new landing page is taking an average of 6-7 seconds to load.

This query is taking 3340ms to run:

app/views/dashboard/new_landing_page.html.slim:41:in `_app_views_dashboard_new_landing_page_html_slim___2538418121397893880_7470340'
app/controllers/application_controller.rb:64:in `switch_locale'
SELECT `users`.`id` AS t0_r0, `users`.`login` AS t0_r1, `users`.`display_name` AS t0_r2, `users`.`real_name` AS t0_r3, `users`.`email` AS t0_r4, `users`.`owner` AS t0_r5, `users`.`admin` AS t0_r6, `users`.`encrypted_password` AS t0_r7, `users`.`password_salt` AS t0_r8, `users`.`created_at` AS t0_r9, `users`.`updated_at` AS t0_r10, `users`.`remember_token` AS t0_r11, `users`.`remember_token_expires_at` AS t0_r12, `users`.`location` AS t0_r13, `users`.`website` AS t0_r14, `users`.`about` AS t0_r15, `users`.`reset_password_token` AS t0_r16, `users`.`reset_password_sent_at` AS t0_r17, `users`.`remember_created_at` AS t0_r18, `users`.`sign_in_count` AS t0_r19, `users`.`current_sign_in_at` AS t0_r20, `users`.`last_sign_in_at` AS t0_r21, `users`.`current_sign_in_ip` AS t0_r22, `users`.`last_sign_in_ip` AS t0_r23, `users`.`account_type` AS t0_r24, `users`.`paid_date` AS t0_r25, `users`.`guest` AS t0_r26, `users`.`slug` AS t0_r27, `users`.`deleted` AS t0_r28, `users`.`provider` AS t0_r29, `users`.`uid` AS t0_r30, `users`.`start_date` AS t0_r31, `users`.`orcid` AS t0_r32, `users`.`dictation_language` AS t0_r33, `users`.`activity_email` AS t0_r34, `users`.`external_id` AS t0_r35, `users`.`sso_issuer` AS t0_r36, `users`.`preferred_locale` AS t0_r37, `users`.`api_key` AS t0_r38, `users`.`picture` AS t0_r39, `users`.`help` AS t0_r40, `users`.`footer_block` AS t0_r41, `collections`.`id` AS t1_r0, `collections`.`title` AS t1_r1, `collections`.`owner_user_id` AS t1_r2, `collections`.`created_on` AS t1_r3, `collections`.`intro_block` AS t1_r4, `collections`.`footer_block` AS t1_r5, `collections`.`restricted` AS t1_r6, `collections`.`picture` AS t1_r7, `collections`.`supports_document_sets` AS t1_r8, `collections`.`subjects_disabled` AS t1_r9, `collections`.`transcription_conventions` AS t1_r10, `collections`.`slug` AS t1_r11, `collections`.`hide_completed` AS t1_r12, `collections`.`help` AS t1_r13, `collections`.`link_help` AS t1_r14, `collections`.`field_based` AS t1_r15, `collections`.`voice_recognition` AS t1_r16, `collections`.`language` AS t1_r17, `collections`.`text_language` AS t1_r18, `collections`.`license_key` AS t1_r19, `collections`.`pct_completed` AS t1_r20, `collections`.`default_orientation` AS t1_r21, `collections`.`is_active` AS t1_r22, `collections`.`works_count` AS t1_r23, `collections`.`next_untranscribed_page_id` AS t1_r24, `collections`.`api_access` AS t1_r25, `collections`.`facets_enabled` AS t1_r26, `collections`.`user_download` AS t1_r27, `collections`.`review_type` AS t1_r28, `collections`.`data_entry_type` AS t1_r29, `collections`.`description_instructions` AS t1_r30, `collections`.`enable_spellcheck` AS t1_r31, `collections`.`messageboard_slug` AS t1_r32, `collections`.`thredded_messageboard_group_id` AS t1_r33, `collections`.`messageboards_enabled` AS t1_r34, `collections`.`most_recent_deed_created_at` AS t1_r35, `collections`.`alphabetize_works` AS t1_r36 FROM `users` INNER JOIN `collections` ON `collections`.`owner_user_id` = `users`.`id` LEFT OUTER JOIN `document_sets` ON `document_sets`.`owner_user_id` = `users`.`id` WHERE `users`.`owner` = TRUE AND NOT ((`users`.`account_type` IN ('Trial', 'Staff') OR `users`.`account_type` IS NULL)) ORDER BY `users`.`display_name` ASC; 
@benwbrum benwbrum self-assigned this May 27, 2024
@benwbrum
Copy link
Owner Author

Line 41 of the view is

    [email protected] do |owner|

Since that's the first time we access @owners, AREL is probably waiting until then to execute the query.

Here is the query in dashboard_controller.rb:


    # Get random Collections and DocSets from paying users
    @owners = User.findaproject_owners.order(:display_name).joins(:collections)
                  .left_outer_joins(:document_sets).includes(:collections)

@benwbrum
Copy link
Owner Author

The old findaproject page has similar performance problems.

@benwbrum benwbrum linked a pull request May 30, 2024 that will close this issue
benwbrum added a commit that referenced this issue Jun 3, 2024
@WillNigel23 WillNigel23 self-assigned this Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants