Add owner_valid to Dast::ProfileScheduleType
What does this MR do and why?
Describe in detail what your merge request does and why.
This merge request adds a new attribute to Types::Dast::ProfileScheduleType.
This attribute will be used to verify if a profile scheduler owner is valid or not.
The ability to create on-demand scans and the user_id null
-check is used to verify whether the owner is valid.
The frontend team will use this attribute to display an error message on the dashboard.
This merge request is part of issue #335662 (closed)
app/models/preloaders/users_max_access_level_in_projects_preloader.rb
New query added for SELECT
MAX("project_authorizations"."access_level") AS maximum_access_level,
"project_authorizations"."project_id" AS project_authorizations_project_id,
"project_authorizations"."user_id" AS project_authorizations_user_id
FROM
"project_authorizations"
WHERE
"project_authorizations"."project_id" IN (278964, 16, 17, 18, 19)
AND "project_authorizations"."user_id" IN (33100, 9430722, 100, 101, 102)
GROUP BY
"project_authorizations"."project_id",
"project_authorizations"."user_id"
https://explain.depesz.com/s/Lpr8
- planning: 1.619 ms
- execution: 15.457 ms
ee/app/finders/dast/profiles_finder.rb
modified queries
Checking our code, we always filter by the project_id at least, but I included all the params combinations below. Only the query without any filter got a recommendation from the database bot.
no params
SQL
SELECT
"dast_profiles"."id" AS t0_r0,
"dast_profiles"."project_id" AS t0_r1,
"dast_profiles"."dast_site_profile_id" AS t0_r2,
"dast_profiles"."dast_scanner_profile_id" AS t0_r3,
"dast_profiles"."created_at" AS t0_r4,
"dast_profiles"."updated_at" AS t0_r5,
"dast_profiles"."name" AS t0_r6,
"dast_profiles"."description" AS t0_r7,
"dast_profiles"."branch_name" AS t0_r8,
"dast_profile_schedules"."id" AS t1_r0,
"dast_profile_schedules"."project_id" AS t1_r1,
"dast_profile_schedules"."dast_profile_id" AS t1_r2,
"dast_profile_schedules"."user_id" AS t1_r3,
"dast_profile_schedules"."next_run_at" AS t1_r4,
"dast_profile_schedules"."created_at" AS t1_r5,
"dast_profile_schedules"."updated_at" AS t1_r6,
"dast_profile_schedules"."active" AS t1_r7,
"dast_profile_schedules"."cron" AS t1_r8,
"dast_profile_schedules"."cadence" AS t1_r9,
"dast_profile_schedules"."timezone" AS t1_r10,
"dast_profile_schedules"."starts_at" AS t1_r11,
"users"."id" AS t2_r0,
"users"."email" AS t2_r1,
"users"."encrypted_password" AS t2_r2,
"users"."reset_password_token" AS t2_r3,
"users"."reset_password_sent_at" AS t2_r4,
"users"."remember_created_at" AS t2_r5,
"users"."sign_in_count" AS t2_r6,
"users"."current_sign_in_at" AS t2_r7,
"users"."last_sign_in_at" AS t2_r8,
"users"."current_sign_in_ip" AS t2_r9,
"users"."last_sign_in_ip" AS t2_r10,
"users"."created_at" AS t2_r11,
"users"."updated_at" AS t2_r12,
"users"."name" AS t2_r13,
"users"."admin" AS t2_r14,
"users"."projects_limit" AS t2_r15,
"users"."skype" AS t2_r16,
"users"."linkedin" AS t2_r17,
"users"."twitter" AS t2_r18,
"users"."failed_attempts" AS t2_r19,
"users"."locked_at" AS t2_r20,
"users"."username" AS t2_r21,
"users"."can_create_group" AS t2_r22,
"users"."can_create_team" AS t2_r23,
"users"."state" AS t2_r24,
"users"."color_scheme_id" AS t2_r25,
"users"."password_expires_at" AS t2_r26,
"users"."created_by_id" AS t2_r27,
"users"."last_credential_check_at" AS t2_r28,
"users"."avatar" AS t2_r29,
"users"."confirmation_token" AS t2_r30,
"users"."confirmed_at" AS t2_r31,
"users"."confirmation_sent_at" AS t2_r32,
"users"."unconfirmed_email" AS t2_r33,
"users"."hide_no_ssh_key" AS t2_r34,
"users"."website_url" AS t2_r35,
"users"."admin_email_unsubscribed_at" AS t2_r36,
"users"."notification_email" AS t2_r37,
"users"."hide_no_password" AS t2_r38,
"users"."password_automatically_set" AS t2_r39,
"users"."location" AS t2_r40,
"users"."encrypted_otp_secret" AS t2_r41,
"users"."encrypted_otp_secret_iv" AS t2_r42,
"users"."encrypted_otp_secret_salt" AS t2_r43,
"users"."otp_required_for_login" AS t2_r44,
"users"."otp_backup_codes" AS t2_r45,
"users"."public_email" AS t2_r46,
"users"."dashboard" AS t2_r47,
"users"."project_view" AS t2_r48,
"users"."consumed_timestep" AS t2_r49,
"users"."layout" AS t2_r50,
"users"."hide_project_limit" AS t2_r51,
"users"."note" AS t2_r52,
"users"."unlock_token" AS t2_r53,
"users"."otp_grace_period_started_at" AS t2_r54,
"users"."external" AS t2_r55,
"users"."incoming_email_token" AS t2_r56,
"users"."organization" AS t2_r57,
"users"."auditor" AS t2_r58,
"users"."require_two_factor_authentication_from_group" AS t2_r59,
"users"."two_factor_grace_period" AS t2_r60,
"users"."last_activity_on" AS t2_r61,
"users"."notified_of_own_activity" AS t2_r62,
"users"."preferred_language" AS t2_r63,
"users"."email_opted_in" AS t2_r64,
"users"."email_opted_in_ip" AS t2_r65,
"users"."email_opted_in_source_id" AS t2_r66,
"users"."email_opted_in_at" AS t2_r67,
"users"."theme_id" AS t2_r68,
"users"."accepted_term_id" AS t2_r69,
"users"."feed_token" AS t2_r70,
"users"."private_profile" AS t2_r71,
"users"."roadmap_layout" AS t2_r72,
"users"."include_private_contributions" AS t2_r73,
"users"."commit_email" AS t2_r74,
"users"."group_view" AS t2_r75,
"users"."managing_group_id" AS t2_r76,
"users"."first_name" AS t2_r77,
"users"."last_name" AS t2_r78,
"users"."static_object_token" AS t2_r79,
"users"."role" AS t2_r80,
"users"."user_type" AS t2_r81,
"users"."static_object_token_encrypted" AS t2_r82
FROM
"dast_profiles"
LEFT OUTER JOIN "dast_profile_schedules" ON "dast_profile_schedules"."dast_profile_id" = "dast_profiles"."id"
LEFT OUTER JOIN "users" ON "users"."id" = "dast_profile_schedules"."user_id"
ORDER BY
"dast_profiles"."id" DESC
LIMIT 100
bot recommendation
Query processes too much data to return a relatively small number of rows. – Reduce data cardinality as early as possible during the execution, using one or several of the following techniques: new indexes, partitioning, query rewriting, denormalization. See the visualization of the plan to understand which plan nodes are the main bottlenecks.
summary
` Time: 224.230 ms
- planning: 9.157 ms
- execution: 215.073 ms
- I/O read: 201.122 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 138 (~1.10 MiB) from the buffer pool
- reads: 105 (~840.00 KiB) from the OS file cache, including disk I/O
- dirtied: 2 (~16.00 KiB)
- writes: 0 `
id
SQL
SELECT
"dast_profiles"."id" AS t0_r0,
"dast_profiles"."project_id" AS t0_r1,
"dast_profiles"."dast_site_profile_id" AS t0_r2,
"dast_profiles"."dast_scanner_profile_id" AS t0_r3,
"dast_profiles"."created_at" AS t0_r4,
"dast_profiles"."updated_at" AS t0_r5,
"dast_profiles"."name" AS t0_r6,
"dast_profiles"."description" AS t0_r7,
"dast_profiles"."branch_name" AS t0_r8,
"dast_profile_schedules"."id" AS t1_r0,
"dast_profile_schedules"."project_id" AS t1_r1,
"dast_profile_schedules"."dast_profile_id" AS t1_r2,
"dast_profile_schedules"."user_id" AS t1_r3,
"dast_profile_schedules"."next_run_at" AS t1_r4,
"dast_profile_schedules"."created_at" AS t1_r5,
"dast_profile_schedules"."updated_at" AS t1_r6,
"dast_profile_schedules"."active" AS t1_r7,
"dast_profile_schedules"."cron" AS t1_r8,
"dast_profile_schedules"."cadence" AS t1_r9,
"dast_profile_schedules"."timezone" AS t1_r10,
"dast_profile_schedules"."starts_at" AS t1_r11,
"users"."id" AS t2_r0,
"users"."email" AS t2_r1,
"users"."encrypted_password" AS t2_r2,
"users"."reset_password_token" AS t2_r3,
"users"."reset_password_sent_at" AS t2_r4,
"users"."remember_created_at" AS t2_r5,
"users"."sign_in_count" AS t2_r6,
"users"."current_sign_in_at" AS t2_r7,
"users"."last_sign_in_at" AS t2_r8,
"users"."current_sign_in_ip" AS t2_r9,
"users"."last_sign_in_ip" AS t2_r10,
"users"."created_at" AS t2_r11,
"users"."updated_at" AS t2_r12,
"users"."name" AS t2_r13,
"users"."admin" AS t2_r14,
"users"."projects_limit" AS t2_r15,
"users"."skype" AS t2_r16,
"users"."linkedin" AS t2_r17,
"users"."twitter" AS t2_r18,
"users"."failed_attempts" AS t2_r19,
"users"."locked_at" AS t2_r20,
"users"."username" AS t2_r21,
"users"."can_create_group" AS t2_r22,
"users"."can_create_team" AS t2_r23,
"users"."state" AS t2_r24,
"users"."color_scheme_id" AS t2_r25,
"users"."password_expires_at" AS t2_r26,
"users"."created_by_id" AS t2_r27,
"users"."last_credential_check_at" AS t2_r28,
"users"."avatar" AS t2_r29,
"users"."confirmation_token" AS t2_r30,
"users"."confirmed_at" AS t2_r31,
"users"."confirmation_sent_at" AS t2_r32,
"users"."unconfirmed_email" AS t2_r33,
"users"."hide_no_ssh_key" AS t2_r34,
"users"."website_url" AS t2_r35,
"users"."admin_email_unsubscribed_at" AS t2_r36,
"users"."notification_email" AS t2_r37,
"users"."hide_no_password" AS t2_r38,
"users"."password_automatically_set" AS t2_r39,
"users"."location" AS t2_r40,
"users"."encrypted_otp_secret" AS t2_r41,
"users"."encrypted_otp_secret_iv" AS t2_r42,
"users"."encrypted_otp_secret_salt" AS t2_r43,
"users"."otp_required_for_login" AS t2_r44,
"users"."otp_backup_codes" AS t2_r45,
"users"."public_email" AS t2_r46,
"users"."dashboard" AS t2_r47,
"users"."project_view" AS t2_r48,
"users"."consumed_timestep" AS t2_r49,
"users"."layout" AS t2_r50,
"users"."hide_project_limit" AS t2_r51,
"users"."note" AS t2_r52,
"users"."unlock_token" AS t2_r53,
"users"."otp_grace_period_started_at" AS t2_r54,
"users"."external" AS t2_r55,
"users"."incoming_email_token" AS t2_r56,
"users"."organization" AS t2_r57,
"users"."auditor" AS t2_r58,
"users"."require_two_factor_authentication_from_group" AS t2_r59,
"users"."two_factor_grace_period" AS t2_r60,
"users"."last_activity_on" AS t2_r61,
"users"."notified_of_own_activity" AS t2_r62,
"users"."preferred_language" AS t2_r63,
"users"."email_opted_in" AS t2_r64,
"users"."email_opted_in_ip" AS t2_r65,
"users"."email_opted_in_source_id" AS t2_r66,
"users"."email_opted_in_at" AS t2_r67,
"users"."theme_id" AS t2_r68,
"users"."accepted_term_id" AS t2_r69,
"users"."feed_token" AS t2_r70,
"users"."private_profile" AS t2_r71,
"users"."roadmap_layout" AS t2_r72,
"users"."include_private_contributions" AS t2_r73,
"users"."commit_email" AS t2_r74,
"users"."group_view" AS t2_r75,
"users"."managing_group_id" AS t2_r76,
"users"."first_name" AS t2_r77,
"users"."last_name" AS t2_r78,
"users"."static_object_token" AS t2_r79,
"users"."role" AS t2_r80,
"users"."user_type" AS t2_r81,
"users"."static_object_token_encrypted" AS t2_r82
FROM
"dast_profiles"
LEFT OUTER JOIN "dast_profile_schedules" ON "dast_profile_schedules"."dast_profile_id" = "dast_profiles"."id"
LEFT OUTER JOIN "users" ON "users"."id" = "dast_profile_schedules"."user_id"
WHERE
"dast_profiles"."id" = 100
ORDER BY
"dast_profiles"."id" DESC
LIMIT 100
summary `
- planning: 0.950 ms
- execution: 1.338 ms
- I/O read: 1.042 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 6 (~48.00 KiB) from the buffer pool
- reads: 1 (~8.00 KiB) from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0 `
project_id
SQL
SELECT
"dast_profiles"."id" AS t0_r0,
"dast_profiles"."project_id" AS t0_r1,
"dast_profiles"."dast_site_profile_id" AS t0_r2,
"dast_profiles"."dast_scanner_profile_id" AS t0_r3,
"dast_profiles"."created_at" AS t0_r4,
"dast_profiles"."updated_at" AS t0_r5,
"dast_profiles"."name" AS t0_r6,
"dast_profiles"."description" AS t0_r7,
"dast_profiles"."branch_name" AS t0_r8,
"dast_profile_schedules"."id" AS t1_r0,
"dast_profile_schedules"."project_id" AS t1_r1,
"dast_profile_schedules"."dast_profile_id" AS t1_r2,
"dast_profile_schedules"."user_id" AS t1_r3,
"dast_profile_schedules"."next_run_at" AS t1_r4,
"dast_profile_schedules"."created_at" AS t1_r5,
"dast_profile_schedules"."updated_at" AS t1_r6,
"dast_profile_schedules"."active" AS t1_r7,
"dast_profile_schedules"."cron" AS t1_r8,
"dast_profile_schedules"."cadence" AS t1_r9,
"dast_profile_schedules"."timezone" AS t1_r10,
"dast_profile_schedules"."starts_at" AS t1_r11,
"users"."id" AS t2_r0,
"users"."email" AS t2_r1,
"users"."encrypted_password" AS t2_r2,
"users"."reset_password_token" AS t2_r3,
"users"."reset_password_sent_at" AS t2_r4,
"users"."remember_created_at" AS t2_r5,
"users"."sign_in_count" AS t2_r6,
"users"."current_sign_in_at" AS t2_r7,
"users"."last_sign_in_at" AS t2_r8,
"users"."current_sign_in_ip" AS t2_r9,
"users"."last_sign_in_ip" AS t2_r10,
"users"."created_at" AS t2_r11,
"users"."updated_at" AS t2_r12,
"users"."name" AS t2_r13,
"users"."admin" AS t2_r14,
"users"."projects_limit" AS t2_r15,
"users"."skype" AS t2_r16,
"users"."linkedin" AS t2_r17,
"users"."twitter" AS t2_r18,
"users"."failed_attempts" AS t2_r19,
"users"."locked_at" AS t2_r20,
"users"."username" AS t2_r21,
"users"."can_create_group" AS t2_r22,
"users"."can_create_team" AS t2_r23,
"users"."state" AS t2_r24,
"users"."color_scheme_id" AS t2_r25,
"users"."password_expires_at" AS t2_r26,
"users"."created_by_id" AS t2_r27,
"users"."last_credential_check_at" AS t2_r28,
"users"."avatar" AS t2_r29,
"users"."confirmation_token" AS t2_r30,
"users"."confirmed_at" AS t2_r31,
"users"."confirmation_sent_at" AS t2_r32,
"users"."unconfirmed_email" AS t2_r33,
"users"."hide_no_ssh_key" AS t2_r34,
"users"."website_url" AS t2_r35,
"users"."admin_email_unsubscribed_at" AS t2_r36,
"users"."notification_email" AS t2_r37,
"users"."hide_no_password" AS t2_r38,
"users"."password_automatically_set" AS t2_r39,
"users"."location" AS t2_r40,
"users"."encrypted_otp_secret" AS t2_r41,
"users"."encrypted_otp_secret_iv" AS t2_r42,
"users"."encrypted_otp_secret_salt" AS t2_r43,
"users"."otp_required_for_login" AS t2_r44,
"users"."otp_backup_codes" AS t2_r45,
"users"."public_email" AS t2_r46,
"users"."dashboard" AS t2_r47,
"users"."project_view" AS t2_r48,
"users"."consumed_timestep" AS t2_r49,
"users"."layout" AS t2_r50,
"users"."hide_project_limit" AS t2_r51,
"users"."note" AS t2_r52,
"users"."unlock_token" AS t2_r53,
"users"."otp_grace_period_started_at" AS t2_r54,
"users"."external" AS t2_r55,
"users"."incoming_email_token" AS t2_r56,
"users"."organization" AS t2_r57,
"users"."auditor" AS t2_r58,
"users"."require_two_factor_authentication_from_group" AS t2_r59,
"users"."two_factor_grace_period" AS t2_r60,
"users"."last_activity_on" AS t2_r61,
"users"."notified_of_own_activity" AS t2_r62,
"users"."preferred_language" AS t2_r63,
"users"."email_opted_in" AS t2_r64,
"users"."email_opted_in_ip" AS t2_r65,
"users"."email_opted_in_source_id" AS t2_r66,
"users"."email_opted_in_at" AS t2_r67,
"users"."theme_id" AS t2_r68,
"users"."accepted_term_id" AS t2_r69,
"users"."feed_token" AS t2_r70,
"users"."private_profile" AS t2_r71,
"users"."roadmap_layout" AS t2_r72,
"users"."include_private_contributions" AS t2_r73,
"users"."commit_email" AS t2_r74,
"users"."group_view" AS t2_r75,
"users"."managing_group_id" AS t2_r76,
"users"."first_name" AS t2_r77,
"users"."last_name" AS t2_r78,
"users"."static_object_token" AS t2_r79,
"users"."role" AS t2_r80,
"users"."user_type" AS t2_r81,
"users"."static_object_token_encrypted" AS t2_r82
FROM
"dast_profiles"
LEFT OUTER JOIN "dast_profile_schedules" ON "dast_profile_schedules"."dast_profile_id" = "dast_profiles"."id"
LEFT OUTER JOIN "users" ON "users"."id" = "dast_profile_schedules"."user_id"
WHERE
"dast_profiles"."project_id" = 6
ORDER BY
"dast_profiles"."id" DESC
LIMIT 100
Summary ` Time: 7.205 ms
- planning: 1.145 ms
- execution: 6.060 ms
- I/O read: 5.723 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 6 (~48.00 KiB) from the buffer pool
- reads: 2 (~16.00 KiB) from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0 `
has_schedule
SQL
SELECT
"dast_profiles"."id" AS t0_r0,
"dast_profiles"."project_id" AS t0_r1,
"dast_profiles"."dast_site_profile_id" AS t0_r2,
"dast_profiles"."dast_scanner_profile_id" AS t0_r3,
"dast_profiles"."created_at" AS t0_r4,
"dast_profiles"."updated_at" AS t0_r5,
"dast_profiles"."name" AS t0_r6,
"dast_profiles"."description" AS t0_r7,
"dast_profiles"."branch_name" AS t0_r8,
"dast_profile_schedules"."id" AS t1_r0,
"dast_profile_schedules"."project_id" AS t1_r1,
"dast_profile_schedules"."dast_profile_id" AS t1_r2,
"dast_profile_schedules"."user_id" AS t1_r3,
"dast_profile_schedules"."next_run_at" AS t1_r4,
"dast_profile_schedules"."created_at" AS t1_r5,
"dast_profile_schedules"."updated_at" AS t1_r6,
"dast_profile_schedules"."active" AS t1_r7,
"dast_profile_schedules"."cron" AS t1_r8,
"dast_profile_schedules"."cadence" AS t1_r9,
"dast_profile_schedules"."timezone" AS t1_r10,
"dast_profile_schedules"."starts_at" AS t1_r11,
"users"."id" AS t2_r0,
"users"."email" AS t2_r1,
"users"."encrypted_password" AS t2_r2,
"users"."reset_password_token" AS t2_r3,
"users"."reset_password_sent_at" AS t2_r4,
"users"."remember_created_at" AS t2_r5,
"users"."sign_in_count" AS t2_r6,
"users"."current_sign_in_at" AS t2_r7,
"users"."last_sign_in_at" AS t2_r8,
"users"."current_sign_in_ip" AS t2_r9,
"users"."last_sign_in_ip" AS t2_r10,
"users"."created_at" AS t2_r11,
"users"."updated_at" AS t2_r12,
"users"."name" AS t2_r13,
"users"."admin" AS t2_r14,
"users"."projects_limit" AS t2_r15,
"users"."skype" AS t2_r16,
"users"."linkedin" AS t2_r17,
"users"."twitter" AS t2_r18,
"users"."failed_attempts" AS t2_r19,
"users"."locked_at" AS t2_r20,
"users"."username" AS t2_r21,
"users"."can_create_group" AS t2_r22,
"users"."can_create_team" AS t2_r23,
"users"."state" AS t2_r24,
"users"."color_scheme_id" AS t2_r25,
"users"."password_expires_at" AS t2_r26,
"users"."created_by_id" AS t2_r27,
"users"."last_credential_check_at" AS t2_r28,
"users"."avatar" AS t2_r29,
"users"."confirmation_token" AS t2_r30,
"users"."confirmed_at" AS t2_r31,
"users"."confirmation_sent_at" AS t2_r32,
"users"."unconfirmed_email" AS t2_r33,
"users"."hide_no_ssh_key" AS t2_r34,
"users"."website_url" AS t2_r35,
"users"."admin_email_unsubscribed_at" AS t2_r36,
"users"."notification_email" AS t2_r37,
"users"."hide_no_password" AS t2_r38,
"users"."password_automatically_set" AS t2_r39,
"users"."location" AS t2_r40,
"users"."encrypted_otp_secret" AS t2_r41,
"users"."encrypted_otp_secret_iv" AS t2_r42,
"users"."encrypted_otp_secret_salt" AS t2_r43,
"users"."otp_required_for_login" AS t2_r44,
"users"."otp_backup_codes" AS t2_r45,
"users"."public_email" AS t2_r46,
"users"."dashboard" AS t2_r47,
"users"."project_view" AS t2_r48,
"users"."consumed_timestep" AS t2_r49,
"users"."layout" AS t2_r50,
"users"."hide_project_limit" AS t2_r51,
"users"."note" AS t2_r52,
"users"."unlock_token" AS t2_r53,
"users"."otp_grace_period_started_at" AS t2_r54,
"users"."external" AS t2_r55,
"users"."incoming_email_token" AS t2_r56,
"users"."organization" AS t2_r57,
"users"."auditor" AS t2_r58,
"users"."require_two_factor_authentication_from_group" AS t2_r59,
"users"."two_factor_grace_period" AS t2_r60,
"users"."last_activity_on" AS t2_r61,
"users"."notified_of_own_activity" AS t2_r62,
"users"."preferred_language" AS t2_r63,
"users"."email_opted_in" AS t2_r64,
"users"."email_opted_in_ip" AS t2_r65,
"users"."email_opted_in_source_id" AS t2_r66,
"users"."email_opted_in_at" AS t2_r67,
"users"."theme_id" AS t2_r68,
"users"."accepted_term_id" AS t2_r69,
"users"."feed_token" AS t2_r70,
"users"."private_profile" AS t2_r71,
"users"."roadmap_layout" AS t2_r72,
"users"."include_private_contributions" AS t2_r73,
"users"."commit_email" AS t2_r74,
"users"."group_view" AS t2_r75,
"users"."managing_group_id" AS t2_r76,
"users"."first_name" AS t2_r77,
"users"."last_name" AS t2_r78,
"users"."static_object_token" AS t2_r79,
"users"."role" AS t2_r80,
"users"."user_type" AS t2_r81,
"users"."static_object_token_encrypted" AS t2_r82
FROM
"dast_profiles"
INNER JOIN "dast_profile_schedules" ON "dast_profile_schedules"."dast_profile_id" = "dast_profiles"."id"
LEFT OUTER JOIN "users" ON "users"."id" = "dast_profile_schedules"."user_id"
ORDER BY
"dast_profiles"."id" DESC
LIMIT 100
Summary
` Time: 1.550 ms
- planning: 0.758 ms
- execution: 0.792 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 349 (~2.70 MiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0 `
id + project_id
SQL
SELECT
"dast_profiles"."id" AS t0_r0,
"dast_profiles"."project_id" AS t0_r1,
"dast_profiles"."dast_site_profile_id" AS t0_r2,
"dast_profiles"."dast_scanner_profile_id" AS t0_r3,
"dast_profiles"."created_at" AS t0_r4,
"dast_profiles"."updated_at" AS t0_r5,
"dast_profiles"."name" AS t0_r6,
"dast_profiles"."description" AS t0_r7,
"dast_profiles"."branch_name" AS t0_r8,
"projects"."id" AS t1_r0,
"projects"."name" AS t1_r1,
"projects"."path" AS t1_r2,
"projects"."description" AS t1_r3,
"projects"."created_at" AS t1_r4,
"projects"."updated_at" AS t1_r5,
"projects"."creator_id" AS t1_r6,
"projects"."namespace_id" AS t1_r7,
"projects"."last_activity_at" AS t1_r8,
"projects"."import_url" AS t1_r9,
"projects"."visibility_level" AS t1_r10,
"projects"."archived" AS t1_r11,
"projects"."avatar" AS t1_r12,
"projects"."merge_requests_template" AS t1_r13,
"projects"."star_count" AS t1_r14,
"projects"."merge_requests_rebase_enabled" AS t1_r15,
"projects"."import_type" AS t1_r16,
"projects"."import_source" AS t1_r17,
"projects"."approvals_before_merge" AS t1_r18,
"projects"."reset_approvals_on_push" AS t1_r19,
"projects"."merge_requests_ff_only_enabled" AS t1_r20,
"projects"."issues_template" AS t1_r21,
"projects"."mirror" AS t1_r22,
"projects"."mirror_user_id" AS t1_r23,
"projects"."shared_runners_enabled" AS t1_r24,
"projects"."runners_token" AS t1_r25,
"projects"."build_coverage_regex" AS t1_r26,
"projects"."build_allow_git_fetch" AS t1_r27,
"projects"."build_timeout" AS t1_r28,
"projects"."mirror_trigger_builds" AS t1_r29,
"projects"."pending_delete" AS t1_r30,
"projects"."public_builds" AS t1_r31,
"projects"."last_repository_check_failed" AS t1_r32,
"projects"."last_repository_check_at" AS t1_r33,
"projects"."only_allow_merge_if_pipeline_succeeds" AS t1_r34,
"projects"."has_external_issue_tracker" AS t1_r35,
"projects"."repository_storage" AS t1_r36,
"projects"."repository_read_only" AS t1_r37,
"projects"."request_access_enabled" AS t1_r38,
"projects"."has_external_wiki" AS t1_r39,
"projects"."ci_config_path" AS t1_r40,
"projects"."lfs_enabled" AS t1_r41,
"projects"."description_html" AS t1_r42,
"projects"."only_allow_merge_if_all_discussions_are_resolved" AS t1_r43,
"projects"."repository_size_limit" AS t1_r44,
"projects"."printing_merge_request_link_enabled" AS t1_r45,
"projects"."auto_cancel_pending_pipelines" AS t1_r46,
"projects"."service_desk_enabled" AS t1_r47,
"projects"."cached_markdown_version" AS t1_r48,
"projects"."delete_error" AS t1_r49,
"projects"."last_repository_updated_at" AS t1_r50,
"projects"."disable_overriding_approvers_per_merge_request" AS t1_r51,
"projects"."storage_version" AS t1_r52,
"projects"."resolve_outdated_diff_discussions" AS t1_r53,
"projects"."remote_mirror_available_overridden" AS t1_r54,
"projects"."only_mirror_protected_branches" AS t1_r55,
"projects"."pull_mirror_available_overridden" AS t1_r56,
"projects"."jobs_cache_index" AS t1_r57,
"projects"."external_authorization_classification_label" AS t1_r58,
"projects"."mirror_overwrites_diverged_branches" AS t1_r59,
"projects"."pages_https_only" AS t1_r60,
"projects"."external_webhook_token" AS t1_r61,
"projects"."packages_enabled" AS t1_r62,
"projects"."merge_requests_author_approval" AS t1_r63,
"projects"."pool_repository_id" AS t1_r64,
"projects"."runners_token_encrypted" AS t1_r65,
"projects"."bfg_object_map" AS t1_r66,
"projects"."detected_repository_languages" AS t1_r67,
"projects"."merge_requests_disable_committers_approval" AS t1_r68,
"projects"."require_password_to_approve" AS t1_r69,
"projects"."emails_disabled" AS t1_r70,
"projects"."max_pages_size" AS t1_r71,
"projects"."max_artifacts_size" AS t1_r72,
"projects"."remove_source_branch_after_merge" AS t1_r73,
"projects"."marked_for_deletion_at" AS t1_r74,
"projects"."marked_for_deletion_by_user_id" AS t1_r75,
"projects"."autoclose_referenced_issues" AS t1_r76,
"projects"."suggestion_commit_message" AS t1_r77,
"projects"."project_namespace_id" AS t1_r78,
"dast_profile_schedules"."id" AS t2_r0,
"dast_profile_schedules"."project_id" AS t2_r1,
"dast_profile_schedules"."dast_profile_id" AS t2_r2,
"dast_profile_schedules"."user_id" AS t2_r3,
"dast_profile_schedules"."next_run_at" AS t2_r4,
"dast_profile_schedules"."created_at" AS t2_r5,
"dast_profile_schedules"."updated_at" AS t2_r6,
"dast_profile_schedules"."active" AS t2_r7,
"dast_profile_schedules"."cron" AS t2_r8,
"dast_profile_schedules"."cadence" AS t2_r9,
"dast_profile_schedules"."timezone" AS t2_r10,
"dast_profile_schedules"."starts_at" AS t2_r11,
"users"."id" AS t3_r0,
"users"."email" AS t3_r1,
"users"."encrypted_password" AS t3_r2,
"users"."reset_password_token" AS t3_r3,
"users"."reset_password_sent_at" AS t3_r4,
"users"."remember_created_at" AS t3_r5,
"users"."sign_in_count" AS t3_r6,
"users"."current_sign_in_at" AS t3_r7,
"users"."last_sign_in_at" AS t3_r8,
"users"."current_sign_in_ip" AS t3_r9,
"users"."last_sign_in_ip" AS t3_r10,
"users"."created_at" AS t3_r11,
"users"."updated_at" AS t3_r12,
"users"."name" AS t3_r13,
"users"."admin" AS t3_r14,
"users"."projects_limit" AS t3_r15,
"users"."skype" AS t3_r16,
"users"."linkedin" AS t3_r17,
"users"."twitter" AS t3_r18,
"users"."failed_attempts" AS t3_r19,
"users"."locked_at" AS t3_r20,
"users"."username" AS t3_r21,
"users"."can_create_group" AS t3_r22,
"users"."can_create_team" AS t3_r23,
"users"."state" AS t3_r24,
"users"."color_scheme_id" AS t3_r25,
"users"."password_expires_at" AS t3_r26,
"users"."created_by_id" AS t3_r27,
"users"."last_credential_check_at" AS t3_r28,
"users"."avatar" AS t3_r29,
"users"."confirmation_token" AS t3_r30,
"users"."confirmed_at" AS t3_r31,
"users"."confirmation_sent_at" AS t3_r32,
"users"."unconfirmed_email" AS t3_r33,
"users"."hide_no_ssh_key" AS t3_r34,
"users"."website_url" AS t3_r35,
"users"."admin_email_unsubscribed_at" AS t3_r36,
"users"."notification_email" AS t3_r37,
"users"."hide_no_password" AS t3_r38,
"users"."password_automatically_set" AS t3_r39,
"users"."location" AS t3_r40,
"users"."encrypted_otp_secret" AS t3_r41,
"users"."encrypted_otp_secret_iv" AS t3_r42,
"users"."encrypted_otp_secret_salt" AS t3_r43,
"users"."otp_required_for_login" AS t3_r44,
"users"."otp_backup_codes" AS t3_r45,
"users"."public_email" AS t3_r46,
"users"."dashboard" AS t3_r47,
"users"."project_view" AS t3_r48,
"users"."consumed_timestep" AS t3_r49,
"users"."layout" AS t3_r50,
"users"."hide_project_limit" AS t3_r51,
"users"."note" AS t3_r52,
"users"."unlock_token" AS t3_r53,
"users"."otp_grace_period_started_at" AS t3_r54,
"users"."external" AS t3_r55,
"users"."incoming_email_token" AS t3_r56,
"users"."organization" AS t3_r57,
"users"."auditor" AS t3_r58,
"users"."require_two_factor_authentication_from_group" AS t3_r59,
"users"."two_factor_grace_period" AS t3_r60,
"users"."last_activity_on" AS t3_r61,
"users"."notified_of_own_activity" AS t3_r62,
"users"."preferred_language" AS t3_r63,
"users"."email_opted_in" AS t3_r64,
"users"."email_opted_in_ip" AS t3_r65,
"users"."email_opted_in_source_id" AS t3_r66,
"users"."email_opted_in_at" AS t3_r67,
"users"."theme_id" AS t3_r68,
"users"."accepted_term_id" AS t3_r69,
"users"."feed_token" AS t3_r70,
"users"."private_profile" AS t3_r71,
"users"."roadmap_layout" AS t3_r72,
"users"."include_private_contributions" AS t3_r73,
"users"."commit_email" AS t3_r74,
"users"."group_view" AS t3_r75,
"users"."managing_group_id" AS t3_r76,
"users"."first_name" AS t3_r77,
"users"."last_name" AS t3_r78,
"users"."static_object_token" AS t3_r79,
"users"."role" AS t3_r80,
"users"."user_type" AS t3_r81,
"users"."static_object_token_encrypted" AS t3_r82
FROM
"dast_profiles"
LEFT OUTER JOIN "projects" ON "projects"."id" = "dast_profiles"."project_id"
LEFT OUTER JOIN "dast_profile_schedules" ON "dast_profile_schedules"."dast_profile_id" = "dast_profiles"."id"
LEFT OUTER JOIN "users" ON "users"."id" = "dast_profile_schedules"."user_id"
WHERE
"dast_profiles"."id" = 100
AND "dast_profiles"."project_id" = 278964
ORDER BY
"dast_profiles"."id" DESC
LIMIT 100
Summary
` Time: 6.894 ms
- planning: 6.568 ms
- execution: 0.326 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 6 (~48.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
`
id + has_schedule
SQL
SELECT
"dast_profiles"."id" AS t0_r0,
"dast_profiles"."project_id" AS t0_r1,
"dast_profiles"."dast_site_profile_id" AS t0_r2,
"dast_profiles"."dast_scanner_profile_id" AS t0_r3,
"dast_profiles"."created_at" AS t0_r4,
"dast_profiles"."updated_at" AS t0_r5,
"dast_profiles"."name" AS t0_r6,
"dast_profiles"."description" AS t0_r7,
"dast_profiles"."branch_name" AS t0_r8,
"dast_profile_schedules"."id" AS t1_r0,
"dast_profile_schedules"."project_id" AS t1_r1,
"dast_profile_schedules"."dast_profile_id" AS t1_r2,
"dast_profile_schedules"."user_id" AS t1_r3,
"dast_profile_schedules"."next_run_at" AS t1_r4,
"dast_profile_schedules"."created_at" AS t1_r5,
"dast_profile_schedules"."updated_at" AS t1_r6,
"dast_profile_schedules"."active" AS t1_r7,
"dast_profile_schedules"."cron" AS t1_r8,
"dast_profile_schedules"."cadence" AS t1_r9,
"dast_profile_schedules"."timezone" AS t1_r10,
"dast_profile_schedules"."starts_at" AS t1_r11,
"users"."id" AS t2_r0,
"users"."email" AS t2_r1,
"users"."encrypted_password" AS t2_r2,
"users"."reset_password_token" AS t2_r3,
"users"."reset_password_sent_at" AS t2_r4,
"users"."remember_created_at" AS t2_r5,
"users"."sign_in_count" AS t2_r6,
"users"."current_sign_in_at" AS t2_r7,
"users"."last_sign_in_at" AS t2_r8,
"users"."current_sign_in_ip" AS t2_r9,
"users"."last_sign_in_ip" AS t2_r10,
"users"."created_at" AS t2_r11,
"users"."updated_at" AS t2_r12,
"users"."name" AS t2_r13,
"users"."admin" AS t2_r14,
"users"."projects_limit" AS t2_r15,
"users"."skype" AS t2_r16,
"users"."linkedin" AS t2_r17,
"users"."twitter" AS t2_r18,
"users"."failed_attempts" AS t2_r19,
"users"."locked_at" AS t2_r20,
"users"."username" AS t2_r21,
"users"."can_create_group" AS t2_r22,
"users"."can_create_team" AS t2_r23,
"users"."state" AS t2_r24,
"users"."color_scheme_id" AS t2_r25,
"users"."password_expires_at" AS t2_r26,
"users"."created_by_id" AS t2_r27,
"users"."last_credential_check_at" AS t2_r28,
"users"."avatar" AS t2_r29,
"users"."confirmation_token" AS t2_r30,
"users"."confirmed_at" AS t2_r31,
"users"."confirmation_sent_at" AS t2_r32,
"users"."unconfirmed_email" AS t2_r33,
"users"."hide_no_ssh_key" AS t2_r34,
"users"."website_url" AS t2_r35,
"users"."admin_email_unsubscribed_at" AS t2_r36,
"users"."notification_email" AS t2_r37,
"users"."hide_no_password" AS t2_r38,
"users"."password_automatically_set" AS t2_r39,
"users"."location" AS t2_r40,
"users"."encrypted_otp_secret" AS t2_r41,
"users"."encrypted_otp_secret_iv" AS t2_r42,
"users"."encrypted_otp_secret_salt" AS t2_r43,
"users"."otp_required_for_login" AS t2_r44,
"users"."otp_backup_codes" AS t2_r45,
"users"."public_email" AS t2_r46,
"users"."dashboard" AS t2_r47,
"users"."project_view" AS t2_r48,
"users"."consumed_timestep" AS t2_r49,
"users"."layout" AS t2_r50,
"users"."hide_project_limit" AS t2_r51,
"users"."note" AS t2_r52,
"users"."unlock_token" AS t2_r53,
"users"."otp_grace_period_started_at" AS t2_r54,
"users"."external" AS t2_r55,
"users"."incoming_email_token" AS t2_r56,
"users"."organization" AS t2_r57,
"users"."auditor" AS t2_r58,
"users"."require_two_factor_authentication_from_group" AS t2_r59,
"users"."two_factor_grace_period" AS t2_r60,
"users"."last_activity_on" AS t2_r61,
"users"."notified_of_own_activity" AS t2_r62,
"users"."preferred_language" AS t2_r63,
"users"."email_opted_in" AS t2_r64,
"users"."email_opted_in_ip" AS t2_r65,
"users"."email_opted_in_source_id" AS t2_r66,
"users"."email_opted_in_at" AS t2_r67,
"users"."theme_id" AS t2_r68,
"users"."accepted_term_id" AS t2_r69,
"users"."feed_token" AS t2_r70,
"users"."private_profile" AS t2_r71,
"users"."roadmap_layout" AS t2_r72,
"users"."include_private_contributions" AS t2_r73,
"users"."commit_email" AS t2_r74,
"users"."group_view" AS t2_r75,
"users"."managing_group_id" AS t2_r76,
"users"."first_name" AS t2_r77,
"users"."last_name" AS t2_r78,
"users"."static_object_token" AS t2_r79,
"users"."role" AS t2_r80,
"users"."user_type" AS t2_r81,
"users"."static_object_token_encrypted" AS t2_r82
FROM
"dast_profiles"
INNER JOIN "dast_profile_schedules" ON "dast_profile_schedules"."dast_profile_id" = "dast_profiles"."id"
LEFT OUTER JOIN "users" ON "users"."id" = "dast_profile_schedules"."user_id"
WHERE
"dast_profiles"."id" = 100
ORDER BY
"dast_profiles"."id" DESC
LIMIT 100
Summary ` Time: 0.898 ms
- planning: 0.721 ms
- execution: 0.177 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 7 (~56.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0 `
project_id + has_schedule
SQL
SELECT
"dast_profiles"."id" AS t0_r0,
"dast_profiles"."project_id" AS t0_r1,
"dast_profiles"."dast_site_profile_id" AS t0_r2,
"dast_profiles"."dast_scanner_profile_id" AS t0_r3,
"dast_profiles"."created_at" AS t0_r4,
"dast_profiles"."updated_at" AS t0_r5,
"dast_profiles"."name" AS t0_r6,
"dast_profiles"."description" AS t0_r7,
"dast_profiles"."branch_name" AS t0_r8,
"dast_profile_schedules"."id" AS t1_r0,
"dast_profile_schedules"."project_id" AS t1_r1,
"dast_profile_schedules"."dast_profile_id" AS t1_r2,
"dast_profile_schedules"."user_id" AS t1_r3,
"dast_profile_schedules"."next_run_at" AS t1_r4,
"dast_profile_schedules"."created_at" AS t1_r5,
"dast_profile_schedules"."updated_at" AS t1_r6,
"dast_profile_schedules"."active" AS t1_r7,
"dast_profile_schedules"."cron" AS t1_r8,
"dast_profile_schedules"."cadence" AS t1_r9,
"dast_profile_schedules"."timezone" AS t1_r10,
"dast_profile_schedules"."starts_at" AS t1_r11,
"users"."id" AS t2_r0,
"users"."email" AS t2_r1,
"users"."encrypted_password" AS t2_r2,
"users"."reset_password_token" AS t2_r3,
"users"."reset_password_sent_at" AS t2_r4,
"users"."remember_created_at" AS t2_r5,
"users"."sign_in_count" AS t2_r6,
"users"."current_sign_in_at" AS t2_r7,
"users"."last_sign_in_at" AS t2_r8,
"users"."current_sign_in_ip" AS t2_r9,
"users"."last_sign_in_ip" AS t2_r10,
"users"."created_at" AS t2_r11,
"users"."updated_at" AS t2_r12,
"users"."name" AS t2_r13,
"users"."admin" AS t2_r14,
"users"."projects_limit" AS t2_r15,
"users"."skype" AS t2_r16,
"users"."linkedin" AS t2_r17,
"users"."twitter" AS t2_r18,
"users"."failed_attempts" AS t2_r19,
"users"."locked_at" AS t2_r20,
"users"."username" AS t2_r21,
"users"."can_create_group" AS t2_r22,
"users"."can_create_team" AS t2_r23,
"users"."state" AS t2_r24,
"users"."color_scheme_id" AS t2_r25,
"users"."password_expires_at" AS t2_r26,
"users"."created_by_id" AS t2_r27,
"users"."last_credential_check_at" AS t2_r28,
"users"."avatar" AS t2_r29,
"users"."confirmation_token" AS t2_r30,
"users"."confirmed_at" AS t2_r31,
"users"."confirmation_sent_at" AS t2_r32,
"users"."unconfirmed_email" AS t2_r33,
"users"."hide_no_ssh_key" AS t2_r34,
"users"."website_url" AS t2_r35,
"users"."admin_email_unsubscribed_at" AS t2_r36,
"users"."notification_email" AS t2_r37,
"users"."hide_no_password" AS t2_r38,
"users"."password_automatically_set" AS t2_r39,
"users"."location" AS t2_r40,
"users"."encrypted_otp_secret" AS t2_r41,
"users"."encrypted_otp_secret_iv" AS t2_r42,
"users"."encrypted_otp_secret_salt" AS t2_r43,
"users"."otp_required_for_login" AS t2_r44,
"users"."otp_backup_codes" AS t2_r45,
"users"."public_email" AS t2_r46,
"users"."dashboard" AS t2_r47,
"users"."project_view" AS t2_r48,
"users"."consumed_timestep" AS t2_r49,
"users"."layout" AS t2_r50,
"users"."hide_project_limit" AS t2_r51,
"users"."note" AS t2_r52,
"users"."unlock_token" AS t2_r53,
"users"."otp_grace_period_started_at" AS t2_r54,
"users"."external" AS t2_r55,
"users"."incoming_email_token" AS t2_r56,
"users"."organization" AS t2_r57,
"users"."auditor" AS t2_r58,
"users"."require_two_factor_authentication_from_group" AS t2_r59,
"users"."two_factor_grace_period" AS t2_r60,
"users"."last_activity_on" AS t2_r61,
"users"."notified_of_own_activity" AS t2_r62,
"users"."preferred_language" AS t2_r63,
"users"."email_opted_in" AS t2_r64,
"users"."email_opted_in_ip" AS t2_r65,
"users"."email_opted_in_source_id" AS t2_r66,
"users"."email_opted_in_at" AS t2_r67,
"users"."theme_id" AS t2_r68,
"users"."accepted_term_id" AS t2_r69,
"users"."feed_token" AS t2_r70,
"users"."private_profile" AS t2_r71,
"users"."roadmap_layout" AS t2_r72,
"users"."include_private_contributions" AS t2_r73,
"users"."commit_email" AS t2_r74,
"users"."group_view" AS t2_r75,
"users"."managing_group_id" AS t2_r76,
"users"."first_name" AS t2_r77,
"users"."last_name" AS t2_r78,
"users"."static_object_token" AS t2_r79,
"users"."role" AS t2_r80,
"users"."user_type" AS t2_r81,
"users"."static_object_token_encrypted" AS t2_r82
FROM
"dast_profiles"
INNER JOIN "dast_profile_schedules" ON "dast_profile_schedules"."dast_profile_id" = "dast_profiles"."id"
LEFT OUTER JOIN "users" ON "users"."id" = "dast_profile_schedules"."user_id"
WHERE
"dast_profiles"."project_id" = 278964
ORDER BY
"dast_profiles"."id" DESC
LIMIT 100
Summary ` Time: 11.221 ms
- planning: 8.026 ms
- execution: 3.195 ms
- I/O read: 2.827 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 7 (~56.00 KiB) from the buffer pool
- reads: 3 (~24.00 KiB) from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0 `
id + project_id + has_schedule
SQL
SELECT
"dast_profiles"."id" AS t0_r0,
"dast_profiles"."project_id" AS t0_r1,
"dast_profiles"."dast_site_profile_id" AS t0_r2,
"dast_profiles"."dast_scanner_profile_id" AS t0_r3,
"dast_profiles"."created_at" AS t0_r4,
"dast_profiles"."updated_at" AS t0_r5,
"dast_profiles"."name" AS t0_r6,
"dast_profiles"."description" AS t0_r7,
"dast_profiles"."branch_name" AS t0_r8,
"projects"."id" AS t1_r0,
"projects"."name" AS t1_r1,
"projects"."path" AS t1_r2,
"projects"."description" AS t1_r3,
"projects"."created_at" AS t1_r4,
"projects"."updated_at" AS t1_r5,
"projects"."creator_id" AS t1_r6,
"projects"."namespace_id" AS t1_r7,
"projects"."last_activity_at" AS t1_r8,
"projects"."import_url" AS t1_r9,
"projects"."visibility_level" AS t1_r10,
"projects"."archived" AS t1_r11,
"projects"."avatar" AS t1_r12,
"projects"."merge_requests_template" AS t1_r13,
"projects"."star_count" AS t1_r14,
"projects"."merge_requests_rebase_enabled" AS t1_r15,
"projects"."import_type" AS t1_r16,
"projects"."import_source" AS t1_r17,
"projects"."approvals_before_merge" AS t1_r18,
"projects"."reset_approvals_on_push" AS t1_r19,
"projects"."merge_requests_ff_only_enabled" AS t1_r20,
"projects"."issues_template" AS t1_r21,
"projects"."mirror" AS t1_r22,
"projects"."mirror_user_id" AS t1_r23,
"projects"."shared_runners_enabled" AS t1_r24,
"projects"."runners_token" AS t1_r25,
"projects"."build_coverage_regex" AS t1_r26,
"projects"."build_allow_git_fetch" AS t1_r27,
"projects"."build_timeout" AS t1_r28,
"projects"."mirror_trigger_builds" AS t1_r29,
"projects"."pending_delete" AS t1_r30,
"projects"."public_builds" AS t1_r31,
"projects"."last_repository_check_failed" AS t1_r32,
"projects"."last_repository_check_at" AS t1_r33,
"projects"."only_allow_merge_if_pipeline_succeeds" AS t1_r34,
"projects"."has_external_issue_tracker" AS t1_r35,
"projects"."repository_storage" AS t1_r36,
"projects"."repository_read_only" AS t1_r37,
"projects"."request_access_enabled" AS t1_r38,
"projects"."has_external_wiki" AS t1_r39,
"projects"."ci_config_path" AS t1_r40,
"projects"."lfs_enabled" AS t1_r41,
"projects"."description_html" AS t1_r42,
"projects"."only_allow_merge_if_all_discussions_are_resolved" AS t1_r43,
"projects"."repository_size_limit" AS t1_r44,
"projects"."printing_merge_request_link_enabled" AS t1_r45,
"projects"."auto_cancel_pending_pipelines" AS t1_r46,
"projects"."service_desk_enabled" AS t1_r47,
"projects"."cached_markdown_version" AS t1_r48,
"projects"."delete_error" AS t1_r49,
"projects"."last_repository_updated_at" AS t1_r50,
"projects"."disable_overriding_approvers_per_merge_request" AS t1_r51,
"projects"."storage_version" AS t1_r52,
"projects"."resolve_outdated_diff_discussions" AS t1_r53,
"projects"."remote_mirror_available_overridden" AS t1_r54,
"projects"."only_mirror_protected_branches" AS t1_r55,
"projects"."pull_mirror_available_overridden" AS t1_r56,
"projects"."jobs_cache_index" AS t1_r57,
"projects"."external_authorization_classification_label" AS t1_r58,
"projects"."mirror_overwrites_diverged_branches" AS t1_r59,
"projects"."pages_https_only" AS t1_r60,
"projects"."external_webhook_token" AS t1_r61,
"projects"."packages_enabled" AS t1_r62,
"projects"."merge_requests_author_approval" AS t1_r63,
"projects"."pool_repository_id" AS t1_r64,
"projects"."runners_token_encrypted" AS t1_r65,
"projects"."bfg_object_map" AS t1_r66,
"projects"."detected_repository_languages" AS t1_r67,
"projects"."merge_requests_disable_committers_approval" AS t1_r68,
"projects"."require_password_to_approve" AS t1_r69,
"projects"."emails_disabled" AS t1_r70,
"projects"."max_pages_size" AS t1_r71,
"projects"."max_artifacts_size" AS t1_r72,
"projects"."remove_source_branch_after_merge" AS t1_r73,
"projects"."marked_for_deletion_at" AS t1_r74,
"projects"."marked_for_deletion_by_user_id" AS t1_r75,
"projects"."autoclose_referenced_issues" AS t1_r76,
"projects"."suggestion_commit_message" AS t1_r77,
"projects"."project_namespace_id" AS t1_r78,
"dast_profile_schedules"."id" AS t2_r0,
"dast_profile_schedules"."project_id" AS t2_r1,
"dast_profile_schedules"."dast_profile_id" AS t2_r2,
"dast_profile_schedules"."user_id" AS t2_r3,
"dast_profile_schedules"."next_run_at" AS t2_r4,
"dast_profile_schedules"."created_at" AS t2_r5,
"dast_profile_schedules"."updated_at" AS t2_r6,
"dast_profile_schedules"."active" AS t2_r7,
"dast_profile_schedules"."cron" AS t2_r8,
"dast_profile_schedules"."cadence" AS t2_r9,
"dast_profile_schedules"."timezone" AS t2_r10,
"dast_profile_schedules"."starts_at" AS t2_r11,
"users"."id" AS t3_r0,
"users"."email" AS t3_r1,
"users"."encrypted_password" AS t3_r2,
"users"."reset_password_token" AS t3_r3,
"users"."reset_password_sent_at" AS t3_r4,
"users"."remember_created_at" AS t3_r5,
"users"."sign_in_count" AS t3_r6,
"users"."current_sign_in_at" AS t3_r7,
"users"."last_sign_in_at" AS t3_r8,
"users"."current_sign_in_ip" AS t3_r9,
"users"."last_sign_in_ip" AS t3_r10,
"users"."created_at" AS t3_r11,
"users"."updated_at" AS t3_r12,
"users"."name" AS t3_r13,
"users"."admin" AS t3_r14,
"users"."projects_limit" AS t3_r15,
"users"."skype" AS t3_r16,
"users"."linkedin" AS t3_r17,
"users"."twitter" AS t3_r18,
"users"."failed_attempts" AS t3_r19,
"users"."locked_at" AS t3_r20,
"users"."username" AS t3_r21,
"users"."can_create_group" AS t3_r22,
"users"."can_create_team" AS t3_r23,
"users"."state" AS t3_r24,
"users"."color_scheme_id" AS t3_r25,
"users"."password_expires_at" AS t3_r26,
"users"."created_by_id" AS t3_r27,
"users"."last_credential_check_at" AS t3_r28,
"users"."avatar" AS t3_r29,
"users"."confirmation_token" AS t3_r30,
"users"."confirmed_at" AS t3_r31,
"users"."confirmation_sent_at" AS t3_r32,
"users"."unconfirmed_email" AS t3_r33,
"users"."hide_no_ssh_key" AS t3_r34,
"users"."website_url" AS t3_r35,
"users"."admin_email_unsubscribed_at" AS t3_r36,
"users"."notification_email" AS t3_r37,
"users"."hide_no_password" AS t3_r38,
"users"."password_automatically_set" AS t3_r39,
"users"."location" AS t3_r40,
"users"."encrypted_otp_secret" AS t3_r41,
"users"."encrypted_otp_secret_iv" AS t3_r42,
"users"."encrypted_otp_secret_salt" AS t3_r43,
"users"."otp_required_for_login" AS t3_r44,
"users"."otp_backup_codes" AS t3_r45,
"users"."public_email" AS t3_r46,
"users"."dashboard" AS t3_r47,
"users"."project_view" AS t3_r48,
"users"."consumed_timestep" AS t3_r49,
"users"."layout" AS t3_r50,
"users"."hide_project_limit" AS t3_r51,
"users"."note" AS t3_r52,
"users"."unlock_token" AS t3_r53,
"users"."otp_grace_period_started_at" AS t3_r54,
"users"."external" AS t3_r55,
"users"."incoming_email_token" AS t3_r56,
"users"."organization" AS t3_r57,
"users"."auditor" AS t3_r58,
"users"."require_two_factor_authentication_from_group" AS t3_r59,
"users"."two_factor_grace_period" AS t3_r60,
"users"."last_activity_on" AS t3_r61,
"users"."notified_of_own_activity" AS t3_r62,
"users"."preferred_language" AS t3_r63,
"users"."email_opted_in" AS t3_r64,
"users"."email_opted_in_ip" AS t3_r65,
"users"."email_opted_in_source_id" AS t3_r66,
"users"."email_opted_in_at" AS t3_r67,
"users"."theme_id" AS t3_r68,
"users"."accepted_term_id" AS t3_r69,
"users"."feed_token" AS t3_r70,
"users"."private_profile" AS t3_r71,
"users"."roadmap_layout" AS t3_r72,
"users"."include_private_contributions" AS t3_r73,
"users"."commit_email" AS t3_r74,
"users"."group_view" AS t3_r75,
"users"."managing_group_id" AS t3_r76,
"users"."first_name" AS t3_r77,
"users"."last_name" AS t3_r78,
"users"."static_object_token" AS t3_r79,
"users"."role" AS t3_r80,
"users"."user_type" AS t3_r81,
"users"."static_object_token_encrypted" AS t3_r82
FROM
"dast_profiles"
INNER JOIN "dast_profile_schedules" ON "dast_profile_schedules"."dast_profile_id" = "dast_profiles"."id"
LEFT OUTER JOIN "users" ON "users"."id" = "dast_profile_schedules"."user_id"
LEFT OUTER JOIN "projects" ON "projects"."id" = "dast_profiles"."project_id"
WHERE
"dast_profiles"."id" = 100
AND "dast_profiles"."project_id" = 278964
ORDER BY
"dast_profiles"."id" DESC
LIMIT 100
Summary ` Time: 2.254 ms
- planning: 1.823 ms
- execution: 0.431 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 6 (~48.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0 `
Recommendations
Specialized index needed – The index(es) currently used does not serve quite well for the needs of this query (notice Rows Removed by Filter: ..., meaning that the index fetched many non-target rows). Consider adding more specialized index(es)
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Start the rails console
rails c
- get a user
user = User.first
- create a new schedule
project = Project.last
dast_site = DastSite.create(project: project, url: 'http://gitlab.com')
dast_site_profile = DastSiteProfile.create(name: 'Dast Site Profile Owner test', project: project, dast_site: dast_site)
dast_scanner_profile = DastScannerProfile.create(project: project, name: 'dast scanner profile owner test')
dast_profile = Dast::Profile.create(description:'dast profile description for ownership test', name: 'Test profile Ownership Test', project: project, dast_site_profile: dast_site_profile, dast_scanner_profile: dast_scanner_profile)
schedule = Dast::ProfileSchedule.create!(user_id: user.id, cron: "*/10 * * * *", next_run_at: Time.zone.now, dast_profile_id: dast_profile.id, project_id: project.id, timezone: "America/New_York", starts_at:Time.zone.now)
- go to /-/graphql-explorer and run a query like:
{
project(fullPath: "gitlab-instance-0c0627c9/Monitoring") {
dastProfiles {
edges {
node {
dastProfileSchedule{
ownerValid
}
}
}
}
}
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- [-] I have evaluated the MR acceptance checklist for this MR.