PgHero
No long running queries
Connections healthy 70
Vacuuming healthy
No columns near integer overflow
No invalid indexes or constraints
16 duplicate indexes
No suggested indexes
53 slow queries

Duplicate Indexes

These indexes exist, but aren’t needed. Remove them for faster writes.

rails generate migration remove_unneeded_indexes

And paste

remove_index :email_addresses, name: "email_addresses_profile_id", column: :profile_id
remove_index :groups_sources, name: "idx_groups_sources_group_id", column: :group_id
remove_index :historyentries, name: "historyentries_profile_id_idx", column: :profile_id
remove_index :jarvi_event_pages, name: "idx_jarvi_event_pages_slug", column: :slug
remove_index :jarvi_event_registrations, name: "idx_jarvi_event_registrations_event_page_id", column: :event_page_id
remove_index :notifications, name: "notifications_unicity_key_idx", column: :unicity_key
remove_index :presets, name: "presets_group_id_idx", column: :group_id
remove_index :profiles_ratings, name: "profiles_ratings_poc_project_id_idx", column: :project_id
remove_index :projects, name: "idx_projects_external_id", column: :external_id
remove_index :projects, name: "projects_group_id_idx", column: :group_id
remove_index :statuses, name: "statuses_status_parent_id_idx", column: :parent_id
remove_index :threads, name: "threads_user_id_index", column: :user_id
remove_index :users_chats, name: "users_chats_user_id_index", column: :user_id
remove_index :users_oauth, name: "users_oauth_external_id_idx", column: :external_id
remove_index :users_variables, name: "users_variables_user_id_idx", column: :user_id
remove_index :wrapped_2025, name: "idx_wrapped_2025_user_id", column: :user_id
Details
On email_addresses
email_addresses_profile_id (profile_id)
is covered by
email_addresses_source_email_profile_id_key (profile_id, email, source)
On groups_sources
idx_groups_sources_group_id (group_id)
is covered by
groups_sources_group_id_source_value_key (group_id, source_value)
On historyentries
historyentries_profile_id_idx (profile_id)
is covered by
historyentries_profile_id_created_at_key (profile_id, created_at)
On jarvi_event_pages
idx_jarvi_event_pages_slug (slug)
is covered by
jarvi_event_pages_slug_key (slug)
On jarvi_event_registrations
idx_jarvi_event_registrations_event_page_id (event_page_id)
is covered by
jarvi_event_registrations_event_page_id_email_key (event_page_id, email)
On notifications
notifications_unicity_key_idx (unicity_key)
is covered by
notifications_unicity_key_key (unicity_key)
On presets
presets_group_id_idx (group_id)
is covered by
presets_group_id_name_key (group_id, name)
On profiles_ratings
profiles_ratings_poc_project_id_idx (project_id)
is covered by
profiles_ratings_poc_project_profile_idx (project_id, profile_id)
On projects
idx_projects_external_id (external_id)
is covered by
projects_external_id_group_id_key (external_id, group_id)
On projects
projects_group_id_idx (group_id)
is covered by
projects_group_id_reference_id_key (group_id, reference_id)
On statuses
statuses_status_parent_id_idx (parent_id)
is covered by
statuses_parent_id (parent_id)
On threads
threads_user_id_index (user_id)
is covered by
threads_user_id_external_id_trigger_profile_significant_identif (user_id, external_id, trigger_profile_significant_identifier)
On users_chats
users_chats_user_id_index (user_id)
is covered by
users_chats_user_id_type_users_oauth_id_external_chat_id_key (user_id, type, users_oauth_id, external_chat_id)
On users_oauth
users_oauth_external_id_idx (external_id)
is covered by
users_oauth_external_id_key (external_id)
On users_variables
users_variables_user_id_idx (user_id)
is covered by
users_variables_user_id_group_variable_name_id_key (user_id, group_variable_name_id)
On wrapped_2025
idx_wrapped_2025_user_id (user_id)
is covered by
idx_wrapped_2025_user_group (user_id, group_id)

Slow Queries

Slow queries take 20 ms or more on average and have been called at least 100 times.

Explain queries to see where to add indexes.

Total Time Average Time Calls
57 min 7% 612 ms 5,591 postgres
SELECT DISTINCT sub.record_id, $1 as rank
FROM (
  SELECT profile_id as record_id
  FROM email_addresses
  WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($2), paradedb.parse($3), paradedb.term($4, $5)])
    
    AND deleted_at IS NULL
    AND profile_id IS NOT NULL
    
    
  LIMIT $6
) sub
54 min 7% 334 ms 9,643 nhost_hasura
SELECT  coalesce(json_agg("root" ), $3 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."count_unread_messages" AS "countUnreadMessages", "_root.base"."count_in_process_for_a_long_time" AS "countInProcessForALongTime", "_root.base"."count_possible_reminders" AS "countPossibleReminders", "_root.base"."count_profiles_with_history_before_this_project" AS "countProfilesWithHistoryBeforeThisProject", "_root.base"."count_applicants" AS "countApplicants", $4 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public"."projects_metrics"  WHERE (("public"."projects_metrics"."id") = ANY(($2)::uuid[]))     ) AS "_root.base"      ) AS "_root"
50 min 6% 48 ms 62,476 nhost_hasura
SELECT  coalesce(json_agg("root" ), $3 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."trigger_short_id" AS "shortId", "_root.base"."added_at" AS "addedAt", "_root.base"."birthday" AS "birthday", "_root.base"."can_send_inmail" AS "canSendInMail", "_root.base"."created_at" AS "createdAt", "_root.base"."created_by_userid" AS "createdByUserId", "_root.base"."deleted_at" AS "deletedAt", "_root.base"."network_distance_level" AS "distance", "_root.base"."external_id" AS "externalId", "_root.base"."trigger_first_name" AS "firstName", "_root.base"."first_name_parsed" AS "firstNameParsed", "_root.base"."first_name_manual" AS "firstNameManual", "_root.base"."group_id" AS "groupId", "_root.base"."headline" AS "headline", "_root.base"."image_id" AS "imageId", "_root.base"."is_talent" AS "isTalent", "_root.base"."is_contact" AS "isContact", "_root.base"."is_hiring" AS "isHiring", "_root.base"."is_open_to_new_opportunities" AS "isOpenToNewOpportunities", "_root.base"."is_influencer" AS "isInfluencer", "_root.base"."is_premium" AS "isPremium", "_root.base"."last_resume_updated_at" AS "lastResumeUpdatedAt", "_root.base"."trigger_last_interaction_date" AS "lastInteractionDate", "_root.base"."trigger_last_interaction_type" AS "lastInteractionType", "_root.base"."trigger_last_name" AS "lastName", "_root.base"."last_name_parsed" AS "lastNameParsed", "_root.base"."last_name_manual" AS "lastNameManual", "_root.base"."linkedin_id" AS "linkedinId", "_root.base"."member_id" AS "memberId", "_root.base"."profile_url" AS "profileUrl", "_root.base"."public_identifier" AS "publicIdentifier", "_root.base"."primary_locale" AS "primaryLocale", "_root.base"."search_string" AS "searchString", "_root.base"."source" AS "source", "_root.base"."status_id" AS "statusId", "_root.base"."talent_identifier" AS "talentIdentifier", "_root.base"."linkedin_sales_navigator_identifier" AS "linkedinSalesNavigatorIdentifier", "_root.base"."trigger_linkedin_significant_identifier" AS "linkedinSignificantIdentifier", "_root.base"."summary" AS "summary", "_root.base"."updated_at" AS "updatedAt", "_root.base"."trigger_count_connexions_with_this_profile" AS "countConnexionsWithThisProfile", "_root.base"."trigger_count_invitations_scheduled_to_this_profile" AS "countInvitationsScheduledToThisProfile", "_root.base"."trigger_count_invitations_sent_to_this_profile" AS "countInvitationsSentToThisProfile", "_root.base"."trigger_count_applications_from_this_profile" AS "countApplicationsFromThisProfile", "_root.base"."trigger_count_messages_received_from_this_profile" AS "countMessagesReceivedFromThisProfile", "_root.base"."trigger_count_messages_scheduled_to_this_profile" AS "countMessagesScheduledToThisProfile", "_root.base"."trigger_count_messages_sent_to_this_profile" AS "countMessagesSentToThisProfile", "_root.base"."trigger_count_resumes" AS "countResumes", "_root.base"."trigger_count_attached_files" AS "countAttachedFiles", "_root.base"."trigger_last_past_interaction_date" AS "lastPastInteractionDate", "_root.or.createdBy"."createdBy" AS "createdBy", "_root.or.image"."image" AS "image", "_root.ar.root.locations"."locations" AS "locations", "_root.ar.root.files"."files" AS "files", "_root.or.lastPosition"."lastPosition" AS "lastPosition", "_root.ar.root.locales"."locales" AS "locales", "_root.ar.root.educations"."educations" AS "educations", "_root.ar.root.fieldsValues"."fieldsValues" AS "fieldsValues", "_root.ar.root.emailAddresses"."emailAddresses" AS "emailAddresses", "_root.ar.root.phoneNumbers"."phoneNumbers" AS "phoneNumbers", "_root.ar.root.assignees"."assignees" AS "assignees", "_root.or.status"."status" AS "status", "_root.ar.root.associations"."associations" AS "associations", $4 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public"."profiles"  WHERE (((("public"."profiles"."group_id") = ((($1->>$5))::uuid)) OR ((("public"."profiles"."group_id") IS NULL) AND (((($1->>$6))::uuid) IS NULL))) AND (("public"."profiles"."id") = ANY(($2)::uuid[])))     ) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.createdBy.base"."display_name" AS "displayName", "_root.or.createdBy.base"."id" AS "id", $7 AS "__typename"       ) AS "_e"      ) ) AS "createdBy" FROM  (SELECT  *  FROM "auth"."users"  WHERE ((("_root.base"."created_by_userid") = ("id")) AND ((EXISTS  (SELECT  $8  FROM "public"."users_groups" AS "__be_0_users_groups" WHERE (((("__be_0_users_groups"."user_id") = ("auth"."users"."id")) AND ($9)) AND (($10) AND (((("__be_0_users_groups"."group_id") = ((($1->>$11))::uuid)) AND ($12)) AND ($13))))     )) OR (("auth"."users"."id") = ((($1->>$14))::uuid))))    LIMIT $15 ) AS "_root.or.createdBy.base"      ) AS "_root.or.createdBy" ON ($16) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.image.base"."public_url" AS "publicUrl", $17 AS "__typename"       ) AS "_e"      ) ) AS "image" FROM  (SELECT  *  FROM "public"."images"  WHERE (("_root.base"."image_id") = ("id"))    LIMIT $18 ) AS "_root.or.image.base"      ) AS "_root.or.image" ON ($19) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.status.base"."title" AS "title", "_root.or.status.base"."color_id" AS "colorId", "_root.or.status.base"."is_auto" AS "isAuto", "_root.or.status.base"."id" AS "id", "_root.or.status.base"."is_protected" AS "isProtected", $20 AS "__typename"       ) AS "_e"      ) ) AS "status" FROM  (SELECT  *  FROM "public"."statuses"  WHERE ((("_root.base"."status_id") = ("id")) AND (((("public"."statuses"."group_id") = ((($1->>$21))::uuid)) OR ((("public"."statuses"."group_id") IS NULL) AND (((($1->>$22))::uuid) IS NULL))) OR (("public"."statuses"."group_id") IS NULL)))    LIMIT $23 ) AS "_root.or.status.base"      ) AS "_root.or.status" ON ($24) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.lastPosition.base"."id" AS "id", "_root.or.lastPosition.base"."start_date" AS "startDate", "_root.or.lastPosition.base"."end_date" AS "endDate", "_root.or.lastPosition.base"."title" AS "title", "_root.or.lastPosition.base"."source" AS "source", "_root.or.lastPosition.base"."company_name" AS "companyName", "_root.or.lastPosition.base"."linkedin_company_id" AS "linkedinCompanyId", "_root.or.lastPosition.or.linkedinCompanyData"."linkedinCompanyData" AS "linkedinCompanyData", $25 AS "__typename"       ) AS "_e"      ) ) AS "lastPosition" FROM  (SELECT  *  FROM "public"."profiles_positions_last_view"  WHERE ((("_root.base"."id") = ("profile_id")) AND ((("public"."profiles_positions_last_view"."group_id") = ((($1->>$26))::uuid)) OR ((("public"."profiles_positions_last_view"."group_id") IS NULL) AND (((($1->>$27))::uuid) IS NULL))))    LIMIT $28 ) AS "_root.or.lastPosition.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.lastPosition.or.linkedinCompanyData.base"."id" AS "id", "_root.or.lastPosition.or.linkedinCompanyData.base"."name" AS "name", "_root.or.lastPosition.or.linkedinCompanyData.or.image"."image" AS "image", $29 AS "__typename"       ) AS "_e"      ) ) AS "linkedinCompanyData" FROM  (SELECT  *  FROM "public"."linkedin_companies_data"  WHERE (("_root.or.lastPosition.base"."linkedin_company_id") = ("id"))    LIMIT $30 ) AS "_root.or.lastPosition.or.linkedinCompanyData.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.lastPosition.or.linkedinCompanyData.or.image.base"."public_url" AS "publicUrl", $31 AS "__typename"       ) AS "_e"      ) ) AS "image" FROM  (SELECT  *  FROM "public"."images"  WHERE (("_root.or.lastPosition.or.linkedinCompanyData.base"."image_id") = ("id"))    LIMIT $32 ) AS "_root.or.lastPosition.or.linkedinCompanyData.or.image.base"      ) AS "_root.or.lastPosition.or.linkedinCompanyData.or.image" ON ($33)      ) AS "_root.or.lastPosition.or.linkedinCompanyData" ON ($34)      ) AS "_root.or.lastPosition" ON ($35) LEFT OUTER JOIN LATERAL (SELECT  coalesce(json_agg("files" ORDER BY "root.ar.root.files.pg.created_at" DESC NULLS FIRST), $36 ) AS "files" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.files.base"."file_id" AS "fileId", "_root.ar.root.files.base"."created_at" AS "createdAt", "_root.ar.root.files.base"."updated_at" AS "updatedAt", "_root.ar.root.files.base"."should_be_parsed" AS "shouldBeParsed", "_root.ar.root.files.base"."parsed_at" AS "parsedAt", "_root.ar.root.files.base"."profile_id" AS "profileId", "_root.ar.root.files.or.file"."file" AS "file", $37 AS "__typename"       ) AS "_e"      ) ) AS "files", "_root.ar.root.files.base"."created_at" AS "root.ar.root.files.pg.created_at" FROM  (SELECT  *  FROM "public"."profiles_files"  WHERE ((("_root.base"."id") = ("profile_id")) AND ((EXISTS  (SELECT  $38  FROM "public"."profiles" AS "__be_0_profiles" WHERE (((("__be_0_profiles"."id") = ("public"."profiles_files"."profile_id")) AND ($39)) AND (($40) AND ((((("__be_0_profiles"."group_id") = ((($1->>$41))::uuid)) OR ((("__be_0_profiles"."group_id") IS NULL) AND (((($1->>$42))::uuid) IS NULL))) AND ($43)) AND ($44))))     )) AND (("public"."profiles_files"."deleted_at") IS NULL)))   ORDER BY "created_at" DESC NULLS FIRST  ) AS "_root.ar.root.files.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.files.or.file.base"."id" AS "id", "_root.ar.root.files.or.file.base"."name" AS "name", "_root.ar.root.files.or.file.base"."etag" AS "etag", "_root.ar.root.files.or.file.base"."mime_type" AS "mimeType", $45 AS "__typename"       ) AS "_e"      ) ) AS "file" FROM  (SELECT  *  FROM "storage"."files"  WHERE (("_root.ar.root.files.base"."file_id") = ("id"))    LIMIT $46 ) AS "_root.ar.root.files.or.file.base"      ) AS "_root.ar.root.files.or.file" ON ($47)    ORDER BY "root.ar.root.files.pg.created_at" DESC NULLS FIRST  ) AS "_root.ar.root.files"      ) AS "_root.ar.root.files" ON ($48) LEFT OUTER JO
42 min 5% 468 ms 5,447 postgres
SELECT DISTINCT sub.record_id, 1 as rank
FROM (
  SELECT profile_id as record_id
  FROM profiles_positions
  WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($dfcfddbcbafafab$title:(imad OR kerbal)^10 OR description:(imad OR kerbal)^1$dfcfddbcbafafab$), paradedb.term('group_id', $efbeaadbefaea$2447b161-2dfb-4def-8829-4f953f6a5eec$efbeaadbefaea$)])
    
    AND deleted_at IS NULL
    AND profile_id IS NOT NULL
    
    
  LIMIT 10000
) sub
29 min 4% 469 ms 3,678 postgres
SELECT DISTINCT sub.record_id, 1 as rank
FROM (
  SELECT profile_id as record_id
  FROM profiles_positions
  WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($beceeae$trigger_company_search_name:(imad OR kerbal)^5$beceeae$), paradedb.term('group_id', $acbfddb$2447b161-2dfb-4def-8829-4f953f6a5eec$acbfddb$)])
    
    AND deleted_at IS NULL
    AND profile_id IS NOT NULL
    AND end_date IS NULL
    
  LIMIT 10000
) sub
28 min 3% 31 ms 53,415 nhost_hasura
SELECT  coalesce(json_agg("root" ), $8 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."trigger_short_id" AS "shortId", "_root.base"."added_at" AS "addedAt", "_root.base"."birthday" AS "birthday", "_root.base"."can_send_inmail" AS "canSendInMail", "_root.base"."trigger_count_connexions_with_this_profile" AS "countConnexionsWithThisProfile", "_root.base"."trigger_count_invitations_scheduled_to_this_profile" AS "countInvitationsScheduledToThisProfile", "_root.base"."trigger_count_invitations_sent_to_this_profile" AS "countInvitationsSentToThisProfile", "_root.base"."trigger_count_applications_from_this_profile" AS "countApplicationsFromThisProfile", "_root.base"."trigger_count_messages_received_from_this_profile" AS "countMessagesReceivedFromThisProfile", "_root.base"."trigger_count_messages_scheduled_to_this_profile" AS "countMessagesScheduledToThisProfile", "_root.base"."trigger_count_messages_sent_to_this_profile" AS "countMessagesSentToThisProfile", "_root.base"."trigger_count_attached_files" AS "countAttachedFiles", "_root.base"."created_at" AS "createdAt", "_root.base"."created_by_userid" AS "createdByUserId", "_root.base"."deleted_at" AS "deletedAt", "_root.base"."network_distance_level" AS "distance", "_root.base"."external_id" AS "externalId", "_root.base"."trigger_first_interaction_date" AS "firstInteractionDate", "_root.base"."trigger_first_name" AS "firstName", "_root.base"."first_name_parsed" AS "firstNameParsed", "_root.base"."first_name_manual" AS "firstNameManual", "_root.base"."group_id" AS "groupId", "_root.base"."trigger_count_resumes" AS "countResumes", "_root.base"."headline" AS "headline", "_root.base"."image_id" AS "imageId", "_root.base"."is_talent" AS "isTalent", "_root.base"."is_contact" AS "isContact", "_root.base"."is_hiring" AS "isHiring", "_root.base"."is_open_to_new_opportunities" AS "isOpenToNewOpportunities", "_root.base"."is_influencer" AS "isInfluencer", "_root.base"."is_premium" AS "isPremium", "_root.base"."trigger_last_interaction_date" AS "lastInteractionDate", "_root.base"."trigger_last_past_interaction_date" AS "lastPastInteractionDate", "_root.base"."trigger_last_interaction_type" AS "lastInteractionType", "_root.base"."last_resume_updated_at" AS "lastResumeUpdatedAt", "_root.base"."trigger_last_name" AS "lastName", "_root.base"."last_name_parsed" AS "lastNameParsed", "_root.base"."last_name_manual" AS "lastNameManual", "_root.base"."linkedin_id" AS "linkedinId", "_root.base"."member_id" AS "memberId", "_root.base"."profile_url" AS "profileUrl", "_root.base"."public_identifier" AS "publicIdentifier", "_root.base"."primary_locale" AS "primaryLocale", "_root.base"."search_string" AS "searchString", "_root.base"."source" AS "source", "_root.base"."status_id" AS "statusId", "_root.base"."talent_identifier" AS "talentIdentifier", "_root.base"."linkedin_sales_navigator_identifier" AS "linkedinSalesNavigatorIdentifier", "_root.base"."trigger_linkedin_significant_identifier" AS "linkedinSignificantIdentifier", "_root.base"."summary" AS "summary", "_root.base"."updated_at" AS "updatedAt", "_root.ar.root.pendingExecuteTriggerTasks"."pendingExecuteTriggerTasks" AS "pendingExecuteTriggerTasks", "_root.ar.root.unreadMessagesNotifications"."unreadMessagesNotifications" AS "unreadMessagesNotifications", "_root.ar.root.protectedCompaniesWorksIn"."protectedCompaniesWorksIn" AS "protectedCompaniesWorksIn", "_root.or.createdBy"."createdBy" AS "createdBy", "_root.or.image"."image" AS "image", "_root.ar.root.locations"."locations" AS "locations", "_root.ar.root.files"."files" AS "files", "_root.or.lastPosition"."lastPosition" AS "lastPosition", "_root.ar.root.positions"."positions" AS "positions", "_root.ar.root.manualHistoryEntries"."manualHistoryEntries" AS "manualHistoryEntries", "_root.ar.root.lastMessages"."lastMessages" AS "lastMessages", "_root.ar.root.locales"."locales" AS "locales", "_root.ar.root.educations"."educations" AS "educations", "_root.ar.root.skills"."skills" AS "skills", "_root.ar.root.fieldsValues"."fieldsValues" AS "fieldsValues", "_root.ar.root.emailAddresses"."emailAddresses" AS "emailAddresses", "_root.ar.root.phoneNumbers"."phoneNumbers" AS "phoneNumbers", "_root.ar.root.assignees"."assignees" AS "assignees", "_root.or.status"."status" AS "status", "_root.ar.root.associations"."associations" AS "associations", $9 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public"."profiles"  WHERE (((("public"."profiles"."group_id") = ((($1->>$10))::uuid)) OR ((("public"."profiles"."group_id") IS NULL) AND (((($1->>$11))::uuid) IS NULL))) AND (("public"."profiles"."id") = (($7)::uuid)))     ) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.createdBy.base"."display_name" AS "displayName", "_root.or.createdBy.base"."id" AS "id", $12 AS "__typename"       ) AS "_e"      ) ) AS "createdBy" FROM  (SELECT  *  FROM "auth"."users"  WHERE ((("_root.base"."created_by_userid") = ("id")) AND ((EXISTS  (SELECT  $13  FROM "public"."users_groups" AS "__be_0_users_groups" WHERE (((("__be_0_users_groups"."user_id") = ("auth"."users"."id")) AND ($14)) AND (($15) AND (((("__be_0_users_groups"."group_id") = ((($1->>$16))::uuid)) AND ($17)) AND ($18))))     )) OR (("auth"."users"."id") = ((($1->>$19))::uuid))))    LIMIT $20 ) AS "_root.or.createdBy.base"      ) AS "_root.or.createdBy" ON ($21) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.image.base"."public_url" AS "publicUrl", $22 AS "__typename"       ) AS "_e"      ) ) AS "image" FROM  (SELECT  *  FROM "public"."images"  WHERE (("_root.base"."image_id") = ("id"))    LIMIT $23 ) AS "_root.or.image.base"      ) AS "_root.or.image" ON ($24) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.status.base"."title" AS "title", "_root.or.status.base"."color_id" AS "colorId", "_root.or.status.base"."is_auto" AS "isAuto", "_root.or.status.base"."id" AS "id", "_root.or.status.base"."is_protected" AS "isProtected", $25 AS "__typename"       ) AS "_e"      ) ) AS "status" FROM  (SELECT  *  FROM "public"."statuses"  WHERE ((("_root.base"."status_id") = ("id")) AND (((("public"."statuses"."group_id") = ((($1->>$26))::uuid)) OR ((("public"."statuses"."group_id") IS NULL) AND (((($1->>$27))::uuid) IS NULL))) OR (("public"."statuses"."group_id") IS NULL)))    LIMIT $28 ) AS "_root.or.status.base"      ) AS "_root.or.status" ON ($29) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.lastPosition.base"."id" AS "id", "_root.or.lastPosition.base"."start_date" AS "startDate", "_root.or.lastPosition.base"."end_date" AS "endDate", "_root.or.lastPosition.base"."title" AS "title", "_root.or.lastPosition.base"."source" AS "source", "_root.or.lastPosition.base"."company_name" AS "companyName", "_root.or.lastPosition.base"."linkedin_company_id" AS "linkedinCompanyId", "_root.or.lastPosition.or.linkedinCompanyData"."linkedinCompanyData" AS "linkedinCompanyData", $30 AS "__typename"       ) AS "_e"      ) ) AS "lastPosition" FROM  (SELECT  *  FROM "public"."profiles_positions_last_view"  WHERE ((("_root.base"."id") = ("profile_id")) AND ((("public"."profiles_positions_last_view"."group_id") = ((($1->>$31))::uuid)) OR ((("public"."profiles_positions_last_view"."group_id") IS NULL) AND (((($1->>$32))::uuid) IS NULL))))    LIMIT $33 ) AS "_root.or.lastPosition.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.lastPosition.or.linkedinCompanyData.base"."id" AS "id", "_root.or.lastPosition.or.linkedinCompanyData.base"."name" AS "name", "_root.or.lastPosition.or.linkedinCompanyData.or.image"."image" AS "image", $34 AS "__typename"       ) AS "_e"      ) ) AS "linkedinCompanyData" FROM  (SELECT  *  FROM "public"."linkedin_companies_data"  WHERE (("_root.or.lastPosition.base"."linkedin_company_id") = ("id"))    LIMIT $35 ) AS "_root.or.lastPosition.or.linkedinCompanyData.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.lastPosition.or.linkedinCompanyData.or.image.base"."public_url" AS "publicUrl", $36 AS "__typename"       ) AS "_e"      ) ) AS "image" FROM  (SELECT  *  FROM "public"."images"  WHERE (("_root.or.lastPosition.or.linkedinCompanyData.base"."image_id") = ("id"))    LIMIT $37 ) AS "_root.or.lastPosition.or.linkedinCompanyData.or.image.base"      ) AS "_root.or.lastPosition.or.linkedinCompanyData.or.image" ON ($38)      ) AS "_root.or.lastPosition.or.linkedinCompanyData" ON ($39)      ) AS "_root.or.lastPosition" ON ($40) LEFT OUTER JOIN LATERAL (SELECT  coalesce(json_agg("files" ORDER BY "root.ar.root.files.pg.created_at" DESC NULLS FIRST), $41 ) AS "files" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.files.base"."file_id" AS "fileId", "_root.ar.root.files.base"."created_at" AS "createdAt", "_root.ar.root.files.base"."updated_at" AS "updatedAt", "_root.ar.root.files.base"."should_be_parsed" AS "shouldBeParsed", "_root.ar.root.files.base"."parsed_at" AS "parsedAt", "_root.ar.root.files.base"."text_content" AS "textContent", "_root.ar.root.files.or.file"."file" AS "file", $42 AS "__typename"       ) AS "_e"      ) ) AS "files", "_root.ar.root.files.base"."created_at" AS "root.ar.root.files.pg.created_at" FROM  (SELECT  *  FROM "public"."profiles_files"  WHERE ((("_root.base"."id") = ("profile_id")) AND ((EXISTS  (SELECT  $43  FROM "public"."profiles" AS "__be_0_profiles" WHERE (((("__be_0_profiles"."id") = ("public"."profiles_files"."profile_id")) AND ($44)) AND (($45) AND ((((("__be_0_profiles"."group_id") = ((($1->>$46))::uuid)) OR ((("__be_0_profiles"."group_id") IS NULL) AND (((($1->>$47))::uuid) IS NULL))) AND ($48)) AND ($49))))     )) AND (("public"."profiles_files"."deleted_at") IS NULL)))   ORDER BY "created_at" DESC NULLS FIRST  ) AS "_root.ar.root.files.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT
23 min 3% 724 ms 1,947 postgres
SELECT profile_id as record_id,
       ROW_NUMBER() OVER (ORDER BY best_score DESC, profile_id) as rank
FROM (
  SELECT profile_id, MAX(score) as best_score
  FROM (
    SELECT profile_id, paradedb.score(id) * (CASE WHEN end_date IS NULL THEN $1 ELSE GREATEST($2, $3 - EXTRACT($4 FROM AGE(NOW(), end_date)) / $5) END * CASE WHEN start_date IS NOT NULL THEN LEAST($6, $7 + EXTRACT($8 FROM AGE(COALESCE(end_date, NOW()), start_date)) / $9) ELSE $10 END * CASE WHEN source = $11 THEN $12 ELSE $13 END) as score
    FROM profiles_positions
    WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($14), paradedb.term($15, $16)])
      
      AND deleted_at IS NULL
      AND profile_id IS NOT NULL
      
      
    ORDER BY paradedb.score(id) DESC
    LIMIT $17
    OFFSET $18
  ) topk
  GROUP BY profile_id
) sub
ORDER BY rank
LIMIT $19
23 min 3% 404 ms 3,383 postgres
SELECT DISTINCT sub.record_id, $1 as rank
FROM (
  SELECT profile_id as record_id
  FROM email_addresses
  WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($2), paradedb.term($3, $4)])
    
    AND deleted_at IS NULL
    AND profile_id IS NOT NULL
    
    
  LIMIT $5
) sub
17 min 2% 40 ms 24,763 nhost_hasura
WITH "_cte_notifications_count_0" AS (SELECT 
($2)::uuid::uuid as "groupId",
($3)::uuid::uuid as "userId",
LEAST($11, COALESCE((
    SELECT COUNT(*)
    FROM (
        SELECT $12
        FROM notifications n
        INNER JOIN historyentries h ON h.id = n.historyentry_id AND h.deleted_at IS NULL AND h.type = $13
        WHERE n.deleted_at IS NULL
        AND n.type = $14
        AND n.read_at IS NULL
        AND n.group_id = ($4)::uuid::uuid
        AND (
                -- Direct notifications to user with project_id IS NULL
                (
                  n.user_id = ($5)::uuid::uuid
                  AND h.project_id IS NULL
                )
            OR ( -- project is assigned to the user and is not deleted
                EXISTS (
                    SELECT $15
                    FROM projects_assignees pa
                    WHERE pa.project_id = h.project_id
                    AND pa.deleted_at IS NULL
                    AND pa.user_id = ($6)::uuid::uuid
                )
                AND NOT EXISTS (
                    SELECT $16
                    FROM projects pj
                    WHERE pj.id = h.project_id
                    AND pj.deleted_at IS NOT NULL
                )
            )
        )
        AND NOT EXISTS (
            SELECT $17
            FROM profiles p
            WHERE p.id = n.profile_id
            AND p.deleted_at IS NOT NULL
        )
        LIMIT $18
    ) sub1
), $19)) as "jobApplicationsNotificationsCount",

-- Messages count (limité à 100) - Version ultra-optimisée
LEAST($20, COALESCE((
    SELECT COUNT(*)
    FROM (
        SELECT $21
            FROM notifications n
            WHERE n.deleted_at IS NULL
            AND n.type = $22
            AND n.read_at IS NULL
            AND n.user_id = ($7)::uuid::uuid
            AND NOT EXISTS (
                SELECT $23
                FROM profiles p
                WHERE p.id = n.profile_id
                AND p.deleted_at IS NOT NULL
            )
            AND NOT EXISTS (
                SELECT $24
                FROM historyentries h
                WHERE h.id = n.historyentry_id
                AND h.deleted_at IS NOT NULL
            )
        LIMIT $25
    ) sub3
), $26)) as "messagesNotificationsCount",

-- Todos count (limité à 100) - Version ultra-optimisée
LEAST($27, COALESCE((
    SELECT COUNT(*)
    FROM (
        SELECT DISTINCT t.id
        FROM todos t
        WHERE t.group_id = ($8)::uuid::uuid
          AND t.deleted_at IS NULL
          AND t.done_at IS NULL
          AND (t.scheduled_at IS NULL OR t.scheduled_at <= NOW())
          AND (
              -- User owns the todo and no specific assignment
              (t.owned_by_user_id = ($9)::uuid::uuid AND NOT EXISTS (
                  SELECT $28 FROM mentions m WHERE m.source_id = t.id AND m.source_type = $29 AND m.target_type = $30 AND m.deleted_at IS NULL
              ))
              OR
              -- User is specifically assigned
              EXISTS (
                  SELECT $31 FROM mentions m WHERE m.source_id = t.id AND m.source_type = $32 AND m.target_type = $33 AND m.target_id = ($10)::uuid::uuid AND m.deleted_at IS NULL
              )
          )
          AND (
              -- Mention no profiles at all
              NOT EXISTS (
                  SELECT $34 FROM mentions m WHERE m.source_id = t.id AND m.source_type = $35 AND m.target_type = $36
              )
              OR
              -- Or at least one profile mention exists with non-deleted profile
              -- Cause we do not want to show todos for deleted profiles only
              EXISTS (
                  SELECT $37 FROM mentions m 
                  INNER JOIN profiles p ON p.id = m.target_id
                  WHERE m.source_id = t.id AND m.source_type = $38 AND m.target_type = $39 AND m.deleted_at IS NULL AND p.deleted_at IS NULL
              )
          )
        LIMIT $40
    ) sub4
), $41)) as "todosCount"
) SELECT  coalesce(json_agg("root" ), $42 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."groupId" AS "groupId", "_root.base"."userId" AS "userId", "_root.base"."jobApplicationsNotificationsCount" AS "jobApplicationsNotificationsCount", "_root.base"."messagesNotificationsCount" AS "messagesNotificationsCount", "_root.base"."todosCount" AS "todosCount", $43 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_cte_notifications_count_0" WHERE ((("_cte_notifications_count_0"."groupId") = ((($1->>$44))::uuid)) AND (("_cte_notifications_count_0"."userId") = ((($1->>$45))::uuid)))     ) AS "_root.base"      ) AS "_root"
12 min 2% 63 ms 11,697 postgres
SELECT DISTINCT sub.record_id, $1 as rank
FROM (
  SELECT id as record_id
  FROM profiles
  WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($2), paradedb.term($3, $4)])
    
    AND deleted_at IS NULL
    
    
    
  LIMIT $5
) sub
12 min 1% 128 ms 5,510 postgres
CREATE TEMP TABLE _all_matched ON COMMIT DROP AS SELECT p.id as id,
         ROW_NUMBER() OVER (ORDER BY p.trigger_last_interaction_date DESC NULLS LAST, p.id ASC) as rn
  FROM profiles p
  
  
  
  WHERE p.deleted_at IS NULL
  AND p.group_id = $1::uuid
  
  AND EXISTS (SELECT $2 FROM profiles_statuses_cache psc WHERE psc.profile_id = p.id AND psc.group_id = $3::uuid AND psc.is_talent = $4)
11 min 1% 326 ms 2,085 nhost_hasura
SELECT  coalesce(json_agg("root" ORDER BY "root.or.historyEntry.or.project.pg.created_at" DESC NULLS LAST, "root.pg.created_at" DESC NULLS LAST, "root.pg.id" ASC NULLS LAST), $7 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."created_at" AS "createdAt", "_root.base"."updated_at" AS "updatedAt", "_root.base"."deleted_at" AS "deletedAt", "_root.base"."read_at" AS "readAt", "_root.base"."type" AS "type", "_root.base"."user_id" AS "userId", "_root.or.profile"."profile" AS "profile", "_root.or.messageScheduled"."messageScheduled" AS "messageScheduled", "_root.or.historyEntry"."historyEntry" AS "historyEntry", $8 AS "__typename"       ) AS "_e"      ) ) AS "root", "_root.or.historyEntry"."root.or.historyEntry.or.project.pg.created_at" AS "root.or.historyEntry.or.project.pg.created_at", "_root.base"."created_at" AS "root.pg.created_at", "_root.base"."id" AS "root.pg.id" FROM  (SELECT  *  FROM "public"."notifications"  WHERE ((("public"."notifications"."group_id") = ((($1->>$9))::uuid)) AND (((("public"."notifications"."deleted_at") IS NULL) OR (("public"."notifications"."deleted_at") >= (($2)::timestamptz))) AND ((("public"."notifications"."type") = (($3)::text)) AND (((("public"."notifications"."deleted_at") IS NULL) AND (EXISTS  (SELECT  $10  FROM "public"."profiles" AS "__be_0_profiles" WHERE (((("__be_0_profiles"."id") = ("public"."notifications"."profile_id")) AND ($11)) AND (((((("__be_0_profiles"."group_id") = ((($1->>$12))::uuid)) OR ((("__be_0_profiles"."group_id") IS NULL) AND (((($1->>$13))::uuid) IS NULL))) AND ($14)) AND ($15)) AND (((("__be_0_profiles"."deleted_at") IS NULL) AND ($16)) AND ($17))))     ))) AND (((EXISTS  (SELECT  $18  FROM "public"."historyentries" AS "__be_1_historyentries" WHERE (((("__be_1_historyentries"."id") = ("public"."notifications"."historyentry_id")) AND ($19)) AND (((((("__be_1_historyentries"."group_id") = ((($1->>$20))::uuid)) OR ((("__be_1_historyentries"."group_id") IS NULL) AND (((($1->>$21))::uuid) IS NULL))) AND ($22)) AND ($23)) AND (((("__be_1_historyentries"."deleted_at") IS NULL) AND ($24)) AND ((EXISTS  (SELECT  $25  FROM "public"."projects" AS "__be_2_projects" WHERE (((("__be_2_projects"."id") = ("__be_1_historyentries"."project_id")) AND ($26)) AND (((((("__be_2_projects"."group_id") = ((($1->>$27))::uuid)) OR ((("__be_2_projects"."group_id") IS NULL) AND (((($1->>$28))::uuid) IS NULL))) AND ($29)) AND ($30)) AND ((EXISTS  (SELECT  $31  FROM "public"."projects_assignees" AS "__be_3_projects_assignees" WHERE (((("__be_3_projects_assignees"."project_id") = ("__be_2_projects"."id")) AND ($32)) AND (($33) AND (((("__be_3_projects_assignees"."user_id") = (($4)::uuid)) AND ($34)) AND (((("__be_3_projects_assignees"."deleted_at") IS NULL) AND ($35)) AND ($36)))))     )) AND (((("__be_2_projects"."deleted_at") IS NULL) AND ($37)) AND ($38)))))     )) AND ($39)))))     )) OR ((("public"."notifications"."user_id") = (($5)::uuid)) AND (EXISTS  (SELECT  $40  FROM "public"."historyentries" AS "__be_4_historyentries" WHERE (((("__be_4_historyentries"."id") = ("public"."notifications"."historyentry_id")) AND ($41)) AND (((((("__be_4_historyentries"."group_id") = ((($1->>$42))::uuid)) OR ((("__be_4_historyentries"."group_id") IS NULL) AND (((($1->>$43))::uuid) IS NULL))) AND ($44)) AND ($45)) AND (((("__be_4_historyentries"."deleted_at") IS NULL) AND ($46)) AND (((("__be_4_historyentries"."project_id") IS NULL) AND ($47)) AND ($48)))))     )))) AND ((("public"."notifications"."read_at") IS NULL) OR (("public"."notifications"."read_at") >= (($6)::timestamptz))))))))     ) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.messageScheduled.base"."id" AS "id", "_root.or.messageScheduled.base"."deleted_at" AS "deletedAt", "_root.or.messageScheduled.base"."is_draft" AS "isDraft", "_root.or.messageScheduled.base"."subject" AS "subject", "_root.or.messageScheduled.base"."text_message" AS "textMessage", "_root.or.messageScheduled.base"."type" AS "type", $49 AS "__typename"       ) AS "_e"      ) ) AS "messageScheduled" FROM  (SELECT  *  FROM "public"."messages_scheduled"  WHERE ((("_root.base"."message_scheduled_id") = ("id")) AND (("public"."messages_scheduled"."group_id") = ((($1->>$50))::uuid)))    LIMIT $51 ) AS "_root.or.messageScheduled.base"      ) AS "_root.or.messageScheduled" ON ($52) LEFT OUTER JOIN LATERAL (SELECT  "_root.or.historyEntry.or.project"."root.or.historyEntry.or.project.pg.created_at" AS "root.or.historyEntry.or.project.pg.created_at", row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.base"."id" AS "id", "_root.or.historyEntry.base"."type" AS "type", "_root.or.historyEntry.base"."trigger_occurred_at" AS "occurredAt", "_root.or.historyEntry.base"."source" AS "source", "public"."historyentries_message_with_confidentiality_settings"("_root.or.historyEntry.base", "hasura_session" => $1)  AS "messageWithConfidentialitySettings", "public"."historyentries_subject_with_confidentiality_settings"("_root.or.historyEntry.base", "hasura_session" => $1)  AS "subjectWithConfidentialitySettings", "_root.or.historyEntry.or.project"."project" AS "project", "_root.or.historyEntry.ar.historyEntry.files"."files" AS "files", $53 AS "__typename"       ) AS "_e"      ) ) AS "historyEntry" FROM  (SELECT  *  FROM "public"."historyentries"  WHERE ((("_root.base"."historyentry_id") = ("id")) AND ((("public"."historyentries"."group_id") = ((($1->>$54))::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND (((($1->>$55))::uuid) IS NULL))))    LIMIT $56 ) AS "_root.or.historyEntry.base" LEFT OUTER JOIN LATERAL (SELECT  "_root.or.historyEntry.or.project.base"."created_at" AS "root.or.historyEntry.or.project.pg.created_at", row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.or.project.base"."id" AS "id", "_root.or.historyEntry.or.project.base"."name" AS "name", "_root.or.historyEntry.or.project.or.company"."company" AS "company", $57 AS "__typename"       ) AS "_e"      ) ) AS "project" FROM  (SELECT  *  FROM "public"."projects"  WHERE ((("_root.or.historyEntry.base"."project_id") = ("id")) AND ((("public"."projects"."group_id") = ((($1->>$58))::uuid)) OR ((("public"."projects"."group_id") IS NULL) AND (((($1->>$59))::uuid) IS NULL))))    LIMIT $60 ) AS "_root.or.historyEntry.or.project.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.or.project.or.company.base"."id" AS "id", "md5_077948e7bbff295097ff401783cb3f33__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData"."linkedinCompanyData" AS "linkedinCompanyData", $61 AS "__typename"       ) AS "_e"      ) ) AS "company" FROM  (SELECT  *  FROM "public"."companies"  WHERE ((("_root.or.historyEntry.or.project.base"."company_id") = ("id")) AND (("public"."companies"."group_id") = ((($1->>$62))::uuid)))    LIMIT $63 ) AS "_root.or.historyEntry.or.project.or.company.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "md5_17543089adf72f49b3baaef6b1428de7__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.base"."id" AS "id", "md5_17543089adf72f49b3baaef6b1428de7__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.base"."name" AS "name", "md5_842292468fab93732a798efc38bc0209__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image"."image" AS "image", $64 AS "__typename"       ) AS "_e"      ) ) AS "linkedinCompanyData" FROM  (SELECT  *  FROM "public"."linkedin_companies_data"  WHERE (("_root.or.historyEntry.or.project.or.company.base"."linkedin_company_id") = ("id"))    LIMIT $65 ) AS "md5_17543089adf72f49b3baaef6b1428de7__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "md5_ec3723e1a27bd9103837f6711a574140__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image.base"."id" AS "id", "md5_ec3723e1a27bd9103837f6711a574140__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image.base"."file_id" AS "fileId", "md5_ec3723e1a27bd9103837f6711a574140__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image.base"."public_url" AS "publicUrl", $66 AS "__typename"       ) AS "_e"      ) ) AS "image" FROM  (SELECT  *  FROM "public"."images"  WHERE (("md5_17543089adf72f49b3baaef6b1428de7__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.base"."image_id") = ("id"))    LIMIT $67 ) AS "md5_ec3723e1a27bd9103837f6711a574140__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image.base"      ) AS "md5_842292468fab93732a798efc38bc0209__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image" ON ($68)      ) AS "md5_077948e7bbff295097ff401783cb3f33__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData" ON ($69)      ) AS "_root.or.historyEntry.or.project.or.company" ON ($70)      ) AS "_root.or.historyEntry.or.project" ON ($71) LEFT OUTER JOIN LATERAL (SELECT  (SELECT  coalesce(json_agg("_sub_query"."files" ORDER BY "ob_col_1" ASC NULLS LAST), $72 )  FROM  (SELECT  "_unnest_table"."files" AS "files", "_unnest_table"."ob_col_1" AS "ob_col_1" FROM UNNEST(array_agg("files" ), array_agg("root.or.historyEntry.ar.historyEntry.files.pg.created_at" )) AS "_unnest_table"("files", "ob_col_1")    ORDER BY "ob_col_1" ASC NULLS LAST LIMIT $73 ) AS "_sub_query"      ) AS "files" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.ar.historyEntry.files.base"."file_id" AS "fileId", "_root.or.historyEntry.ar.historyEntry.files.base"."created_at" AS "createdAt", "_root.or.historyEntry.ar.historyEntry.files.base"."updated_at" AS "updatedAt", "_root.or.historyEntry.ar.historyEntry.files.or.file"."file" AS "file", $74 AS "__typename"       ) AS "_e"      ) ) AS "files", "_root.or.historyEntry.ar.historyEntry.files.base"."created_at" AS "root.or.histo
11 min 1% 55 ms 11,468 postgres
SELECT DISTINCT sub.record_id, $1 as rank
FROM (
  SELECT id as record_id
  FROM profiles
  WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($2), paradedb.parse($3), paradedb.term($4, $5)])
    
    AND deleted_at IS NULL
    
    
    
  LIMIT $6
) sub
10 min 1% 1,481 ms 421 nhost_hasura
SELECT  coalesce(json_agg("root" ), '[]' ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."user_id" AS "userId", "_root.base"."type" AS "type", "_root.base"."pending_count" AS "pendingCount", "_root.base"."last_done_at" AS "lastDoneAt", 'users_tasks_infos' AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public"."users_tasks_infos"  WHERE ((("public"."users_tasks_infos"."user_id") = ((($1->>'x-hasura-user-id'))::uuid)) OR ((("public"."users_tasks_infos"."user_id") IS NULL) AND (((($1->>'x-hasura-user-id'))::uuid) IS NULL)))    LIMIT 5000 ) AS "_root.base"      ) AS "_root"
9 min 1% 42 ms 12,532 nhost_hasura
SELECT  coalesce(json_agg("root" ), $5 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."profile_id" AS "profileId", "_root.base"."external_id" AS "externalId", $6 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public"."historyentries"  WHERE (((("public"."historyentries"."group_id") = ((($1->>$7))::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND (((($1->>$8))::uuid) IS NULL))) AND ((("public"."historyentries"."profile_id") = ANY(($2)::uuid[])) AND ((("public"."historyentries"."type") = (($3)::text)) AND ((("public"."historyentries"."user_id") = (($4)::uuid)) AND (("public"."historyentries"."deleted_at") IS NULL)))))    LIMIT $9 ) AS "_root.base"      ) AS "_root"
8 min 0.9% 237 ms 1,939 postgres
SELECT profile_id as record_id,
       ROW_NUMBER() OVER (ORDER BY best_score DESC, profile_id) as rank
FROM (
  SELECT profile_id, MAX(score) as best_score
  FROM (
    SELECT profile_id, paradedb.score(id) as score
    FROM profiles_educations
    WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($1), paradedb.term($2, $3)])
      
      AND deleted_at IS NULL
      AND profile_id IS NOT NULL
      
      
    ORDER BY paradedb.score(id) DESC
    LIMIT $4
    OFFSET $5
  ) topk
  GROUP BY profile_id
) sub
ORDER BY rank
LIMIT $6
7 min 0.9% 455 ms 951 postgres
WITH
all_matched_count AS (
  SELECT count(*) as cnt
  FROM profiles p
  
  
  WHERE p.deleted_at IS NULL
  AND p.group_id = $1::uuid
  
  AND EXISTS (SELECT $2 FROM profiles_associations pa WHERE pa.profile_id = p.id AND pa.group_id = $3::uuid AND pa.deleted_at IS NULL AND (pa.company_id = $4::uuid OR pa.project_id IN (SELECT id FROM projects WHERE company_id = $5::uuid AND deleted_at IS NULL)) AND pa.association_type = $6)
  
),
all_matched AS (
  SELECT p.id as id
  FROM profiles p
  
  
  
  WHERE p.deleted_at IS NULL
  AND p.group_id = $7::uuid
  
  AND EXISTS (SELECT $8 FROM profiles_associations pa WHERE pa.profile_id = p.id AND pa.group_id = $9::uuid AND pa.deleted_at IS NULL AND (pa.company_id = $10::uuid OR pa.project_id IN (SELECT id FROM projects WHERE company_id = $11::uuid AND deleted_at IS NULL)) AND pa.association_type = $12)
  
  ORDER BY p.id DESC NULLS LAST, p.id ASC
  LIMIT $13 OFFSET $14
)
SELECT json_build_object(
  $15, (SELECT COALESCE(json_agg(id), $16::json) FROM all_matched),
  $17, (SELECT cnt FROM all_matched_count),
  $18, $19::json
)::text as result
7 min 0.8% 98 ms 4,080 nhost_hasura
SELECT  coalesce(json_agg("root" ), $5 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."priority" AS "priority", "_root.base"."created_at" AS "createdAt", "_root.base"."updated_at" AS "updatedAt", "_root.base"."deleted_at" AS "deletedAt", "_root.base"."done_at" AS "doneAt", "_root.base"."cancel_at" AS "cancelAt", "_root.base"."user_id" AS "userId", "_root.base"."group_id" AS "groupId", "_root.base"."linkedin_seat_id" AS "linkedinSeatId", "_root.base"."type" AS "type", "_root.base"."status" AS "status", "_root.base"."since" AS "since", "_root.base"."retries" AS "retries", "_root.base"."parameters" AS "parameters", "_root.base"."profile_id" AS "profileId", "_root.base"."version" AS "version", "_root.base"."duration" AS "duration", "_root.or.profile"."profile" AS "profile", "_root.base"."trigger_id" AS "triggerId", "_root.or.trigger"."trigger" AS "trigger", "_root.base"."dashboard_id" AS "dashboardId", "_root.base"."project_id" AS "projectId", "_root.or.project"."project" AS "project", "_root.base"."recording_id" AS "recordingId", "_root.base"."historyentry_id" AS "historyEntryId", "_root.or.historyEntry"."historyEntry" AS "historyEntry", "_root.or.user"."user" AS "user", "_root.base"."file_id" AS "fileId", "_root.base"."email_address" AS "emailAddress", "_root.base"."phone_number_provider_id" AS "phoneNumberProviderId", "_root.base"."message_scheduled_id" AS "messageScheduledId", "_root.base"."external_id" AS "externalId", "_root.base"."return" AS "return", "_root.base"."return_status_code" AS "returnStatusCode", "_root.base"."oauth_account_id" AS "oAuthAccountId", "_root.or.typeComment"."typeComment" AS "typeComment", "_root.base"."retry_at" AS "retryAt", "_root.base"."resume_when" AS "resumeWhen", "_root.base"."skip_extension_queue_and_execute_immediately" AS "skipExtensionQueueAndExecuteImmediately", $6 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public"."tasks"  WHERE ((("public"."tasks"."deleted_at") IS NULL) AND ((("public"."tasks"."status") <> (($2)::text)) AND ((("public"."tasks"."type") = (($3)::text)) AND (("public"."tasks"."external_id") = (($4)::text)))))    LIMIT $7 ) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.trigger.base"."name" AS "name", "_root.or.trigger.base"."user_id" AS "userId", "_root.or.trigger.base"."updated_at" AS "updatedAt", "_root.or.trigger.base"."id" AS "id", "_root.or.trigger.base"."group_id" AS "groupId", "_root.or.trigger.base"."targeted_entity" AS "targetedEntity", "_root.or.trigger.base"."event_types" AS "eventTypes", "_root.or.trigger.base"."event_table_name" AS "eventTableName", "_root.or.trigger.base"."event_projects_ids" AS "eventProjectsIds", "_root.or.trigger.base"."event_statuses_ids" AS "eventStatusesIds", "_root.or.trigger.base"."deleted_at" AS "deletedAt", "_root.or.trigger.base"."disabled_at" AS "disabledAt", "_root.or.trigger.base"."created_at" AS "createdAt", "_root.or.trigger.base"."conditions" AS "conditions", "_root.or.trigger.base"."cancel_if_status_changes_to_archived" AS "cancelIfStatusChangesToArchived", "_root.or.trigger.base"."cancel_if_status_changes" AS "cancelIfStatusChanges", "_root.or.trigger.base"."cancel_if_new_message_received" AS "cancelIfNewMessageReceived", "_root.or.trigger.base"."cancel_if_new_event_scheduled" AS "cancelIfNewEventScheduled", "_root.or.trigger.base"."action_task_parameters" AS "actionTaskParameters", "_root.or.trigger.base"."restricted_to_users_ids" AS "restrictedToUsersIds", "_root.or.trigger.base"."ai_legal_validated_at" AS "aiLegalValidatedAt", "_root.or.trigger.base"."ai_legal_validated_by" AS "aiLegalValidatedBy", $8 AS "__typename"       ) AS "_e"      ) ) AS "trigger" FROM  (SELECT  *  FROM "public"."triggers"  WHERE (("_root.base"."trigger_id") = ("id"))    LIMIT $9 ) AS "_root.or.trigger.base"      ) AS "_root.or.trigger" ON ($10) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.typeComment.base"."comment" AS "comment", $11 AS "__typename"       ) AS "_e"      ) ) AS "typeComment" FROM  (SELECT  *  FROM "public"."tasks_types"  WHERE (("_root.base"."type") = ("value"))    LIMIT $12 ) AS "_root.or.typeComment.base"      ) AS "_root.or.typeComment" ON ($13) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.project.base"."id" AS "id", "_root.or.project.base"."name" AS "name", "_root.or.project.base"."reference_id" AS "referenceId", "_root.or.project.base"."linkedin_id" AS "linkedinId", "_root.or.project.base"."linkedin_id_type" AS "linkedinIdType", "_root.or.project.base"."is_made_for_sales" AS "isMadeForSales", "_root.or.project.base"."is_made_for_recruitment" AS "isMadeForRecruitment", "_root.or.project.or.status"."status" AS "status", "_root.or.project.or.company"."company" AS "company", $14 AS "__typename"       ) AS "_e"      ) ) AS "project" FROM  (SELECT  *  FROM "public"."projects"  WHERE (("_root.base"."project_id") = ("id"))    LIMIT $15 ) AS "_root.or.project.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.project.or.company.base"."id" AS "id", "_root.or.project.or.company.base"."description" AS "description", "_root.or.project.or.company.or.linkedinCompanyData"."linkedinCompanyData" AS "linkedinCompanyData", $16 AS "__typename"       ) AS "_e"      ) ) AS "company" FROM  (SELECT  *  FROM "public"."companies"  WHERE (("_root.or.project.base"."company_id") = ("id"))    LIMIT $17 ) AS "_root.or.project.or.company.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.project.or.company.or.linkedinCompanyData.base"."id" AS "id", "_root.or.project.or.company.or.linkedinCompanyData.base"."name" AS "name", $18 AS "__typename"       ) AS "_e"      ) ) AS "linkedinCompanyData" FROM  (SELECT  *  FROM "public"."linkedin_companies_data"  WHERE (("_root.or.project.or.company.base"."linkedin_company_id") = ("id"))    LIMIT $19 ) AS "_root.or.project.or.company.or.linkedinCompanyData.base"      ) AS "_root.or.project.or.company.or.linkedinCompanyData" ON ($20)      ) AS "_root.or.project.or.company" ON ($21) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.project.or.status.base"."title" AS "title", "_root.or.project.or.status.base"."id" AS "id", $22 AS "__typename"       ) AS "_e"      ) ) AS "status" FROM  (SELECT  *  FROM "public"."statuses"  WHERE (("_root.or.project.base"."status_id") = ("id"))    LIMIT $23 ) AS "_root.or.project.or.status.base"      ) AS "_root.or.project.or.status" ON ($24)      ) AS "_root.or.project" ON ($25) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.profile.base"."id" AS "id", "_root.or.profile.base"."trigger_first_name" AS "firstName", "_root.or.profile.base"."trigger_last_name" AS "lastName", "_root.or.profile.base"."talent_identifier" AS "talentIdentifier", "_root.or.profile.base"."linkedin_sales_navigator_identifier" AS "linkedinSalesNavigatorIdentifier", "_root.or.profile.base"."linkedin_id" AS "linkedinId", "_root.or.profile.base"."trigger_linkedin_significant_identifier" AS "linkedinSignificantIdentifier", "_root.or.profile.base"."member_id" AS "memberId", "_root.or.profile.base"."public_identifier" AS "publicIdentifier", "_root.or.profile.base"."external_id" AS "externalId", "_root.or.profile.base"."is_contact" AS "isContact", "_root.or.profile.base"."is_talent" AS "isTalent", "_root.or.profile.base"."deleted_at" AS "deletedAt", $26 AS "__typename"       ) AS "_e"      ) ) AS "profile" FROM  (SELECT  *  FROM "public"."profiles"  WHERE (("_root.base"."profile_id") = ("id"))    LIMIT $27 ) AS "_root.or.profile.base"      ) AS "_root.or.profile" ON ($28) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.user.base"."id" AS "id", "_root.or.user.base"."display_name" AS "displayName", "_root.or.user.base"."email" AS "email", $29 AS "__typename"       ) AS "_e"      ) ) AS "user" FROM  (SELECT  *  FROM "auth"."users"  WHERE (("_root.base"."user_id") = ("id"))    LIMIT $30 ) AS "_root.or.user.base"      ) AS "_root.or.user" ON ($31) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.base"."id" AS "id", "_root.or.historyEntry.base"."created_at" AS "createdAt", "_root.or.historyEntry.base"."event_start_at" AS "eventStartAt", "_root.or.historyEntry.base"."event_end_at" AS "eventEndAt", "_root.or.historyEntry.base"."type" AS "type", "_root.or.historyEntry.or.sender"."sender" AS "sender", "_root.or.historyEntry.base"."subject" AS "subject", "_root.or.historyEntry.base"."message" AS "message", $32 AS "__typename"       ) AS "_e"      ) ) AS "historyEntry" FROM  (SELECT  *  FROM "public"."historyentries"  WHERE (("_root.base"."historyentry_id") = ("id"))    LIMIT $33 ) AS "_root.or.historyEntry.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.or.sender.base"."id" AS "id", "_root.or.historyEntry.or.sender.base"."display_name" AS "displayName", $34 AS "__typename"       ) AS "_e"      ) ) AS "sender" FROM  (SELECT  *  FROM "auth"."users"  WHERE (("_root.or.historyEntry.base"."sender_user_id") = ("id"))    LIMIT $35 ) AS "_root.or.historyEntry.or.sender.base"      ) AS "_root.or.historyEntry.or.sender" ON ($36)      ) AS "_root.or.historyEntry" ON ($37)      ) AS "_root"
7 min 0.8% 26 ms 15,328 nhost_hasura
WITH "_mra__threads" AS (INSERT INTO "public"."threads" ( "user_id", "last_event_at", "linkedin_seat_id", "type", "profile_talent_identifier", "external_id" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::integer, ($4)::text, ($5)::text, ($6)::text), (($7)::uuid, ($8)::timestamptz, ($9)::integer, ($10)::text, ($11)::text, ($12)::text), (($13)::uuid, ($14)::timestamptz, ($15)::integer, ($16)::text, ($17)::text, ($18)::text), (($19)::uuid, ($20)::timestamptz, ($21)::integer, ($22)::text, ($23)::text, ($24)::text), (($25)::uuid, ($26)::timestamptz, ($27)::integer, ($28)::text, ($29)::text, ($30)::text), (($31)::uuid, ($32)::timestamptz, ($33)::integer, ($34)::text, ($35)::text, ($36)::text), (($37)::uuid, ($38)::timestamptz, ($39)::integer, ($40)::text, ($41)::text, ($42)::text), (($43)::uuid, ($44)::timestamptz, ($45)::integer, ($46)::text, ($47)::text, ($48)::text), (($49)::uuid, ($50)::timestamptz, ($51)::integer, ($52)::text, ($53)::text, ($54)::text), (($55)::uuid, ($56)::timestamptz, ($57)::integer, ($58)::text, ($59)::text, ($60)::text), (($61)::uuid, ($62)::timestamptz, ($63)::integer, ($64)::text, ($65)::text, ($66)::text), (($67)::uuid, ($68)::timestamptz, ($69)::integer, ($70)::text, ($71)::text, ($72)::text), (($73)::uuid, ($74)::timestamptz, ($75)::integer, ($76)::text, ($77)::text, ($78)::text), (($79)::uuid, ($80)::timestamptz, ($81)::integer, ($82)::text, ($83)::text, ($84)::text), (($85)::uuid, ($86)::timestamptz, ($87)::integer, ($88)::text, ($89)::text, ($90)::text) ON CONFLICT ON CONSTRAINT "threads_user_id_external_id_trigger_profile_significant_identif" DO UPDATE SET "profile_member_id" = EXCLUDED."profile_member_id","last_event_at" = EXCLUDED."last_event_at","email_address" = EXCLUDED."email_address","linkedin_seat_id" = EXCLUDED."linkedin_seat_id","type" = EXCLUDED."type","oauth_account_id" = EXCLUDED."oauth_account_id","profile_talent_identifier" = EXCLUDED."profile_talent_identifier","profile_sales_navigator_identifier" = EXCLUDED."profile_sales_navigator_identifier" WHERE ((((("public"."threads"."user_id") = (($91)::uuid)) AND ($92)) AND ($93)) AND ($94)) RETURNING * , CASE WHEN ("public"."threads"."xmax") = ($95) THEN ($96)::boolean ELSE (((("public"."threads"."user_id") = (($97)::uuid)) AND ($98)) AND ($99))::boolean END AS "check__constraint"), "_aca__threads" AS (SELECT  "id" , "created_at" , "updated_at" , "user_id" , "external_id" , "linkedin_seat_id" , "last_event_at" , "type" , "profile_linkedin_id" , "profile_talent_identifier" , "profile_sales_navigator_identifier" , "trigger_profile_significant_identifier" , "profile_member_id" , "email_address" , "oauth_account_id" , "canonical_phone_number"  FROM "_mra__threads"      ) SELECT  json_build_object($100, (SELECT  coalesce(json_agg("root" ), $101 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", $102 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_aca__threads" WHERE ($103)     ) AS "_root.base"      ) AS "_root"      ), $104, $105 ) , (SELECT  coalesce(bool_and("check__constraint" ), $106 )  FROM "_mra__threads"      )
7 min 0.8% 84 ms 4,687 nhost_hasura
SELECT  coalesce(json_agg("root" ), $3 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."project_id" AS "projectId", "_root.base"."statuses_metrics" AS "statusesMetrics", $4 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public"."projects_statuses_metrics"  WHERE (("public"."projects_statuses_metrics"."id") = (($2)::uuid))    LIMIT $5 ) AS "_root.base"      ) AS "_root"
6 min 0.8% 21 ms 17,924 nhost_hasura
SELECT  coalesce(json_agg("root" ORDER BY "root.pg.id" DESC NULLS LAST), $3 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."profile_id" AS "profileId", "_root.base"."company_id" AS "companyId", "_root.base"."company_name" AS "companyName", "_root.base"."is_protected" AS "isProtected", $4 AS "__typename"       ) AS "_e"      ) ) AS "root", "_root.base"."id" AS "root.pg.id" FROM  (SELECT  *  FROM "public"."companies_profiles_is_protected_view"  WHERE (("public"."companies_profiles_is_protected_view"."profile_id") = (($2)::uuid))   ORDER BY "id" DESC NULLS LAST LIMIT $5 OFFSET $6) AS "_root.base"    ORDER BY "root.pg.id" DESC NULLS LAST  ) AS "_root"
6 min 0.7% 48 ms 6,875 nhost_hasura
WITH "_mra__profiles_skills" AS (INSERT INTO "public"."profiles_skills" ( "deleted_at", "name", "source", "profile_id", "group_id" ) VALUES (($1)::timestamptz, ($2)::text, ($3)::text, $4, ($5)::uuid), (($6)::timestamptz, ($7)::text, ($8)::text, $9, ($10)::uuid), (($11)::timestamptz, ($12)::text, ($13)::text, $14, ($15)::uuid), (($16)::timestamptz, ($17)::text, ($18)::text, $19, ($20)::uuid), (($21)::timestamptz, ($22)::text, ($23)::text, $24, ($25)::uuid), (($26)::timestamptz, ($27)::text, ($28)::text, $29, ($30)::uuid), (($31)::timestamptz, ($32)::text, ($33)::text, $34, ($35)::uuid), (($36)::timestamptz, ($37)::text, ($38)::text, $39, ($40)::uuid), (($41)::timestamptz, ($42)::text, ($43)::text, $44, ($45)::uuid), (($46)::timestamptz, ($47)::text, ($48)::text, $49, ($50)::uuid), (($51)::timestamptz, ($52)::text, ($53)::text, $54, ($55)::uuid), (($56)::timestamptz, ($57)::text, ($58)::text, $59, ($60)::uuid), (($61)::timestamptz, ($62)::text, ($63)::text, $64, ($65)::uuid), (($66)::timestamptz, ($67)::text, ($68)::text, $69, ($70)::uuid), (($71)::timestamptz, ($72)::text, ($73)::text, $74, ($75)::uuid), (($76)::timestamptz, ($77)::text, ($78)::text, $79, ($80)::uuid), (($81)::timestamptz, ($82)::text, ($83)::text, $84, ($85)::uuid), (($86)::timestamptz, ($87)::text, ($88)::text, $89, ($90)::uuid), (($91)::timestamptz, ($92)::text, ($93)::text, $94, ($95)::uuid), (($96)::timestamptz, ($97)::text, ($98)::text, $99, ($100)::uuid) ON CONFLICT ON CONSTRAINT "profiles_skills_name_profile_id_key" DO NOTHING RETURNING * , CASE WHEN ("public"."profiles_skills"."xmax") = ($101) THEN (((("public"."profiles_skills"."group_id") = (($102)::uuid)) AND ($103)) AND ($104))::boolean ELSE (((("public"."profiles_skills"."group_id") = (($105)::uuid)) AND ($106)) AND ($107))::boolean END AS "check__constraint"), "_aca__profiles_skills" AS (SELECT  "id" , "created_at" , "updated_at" , "deleted_at" , "profile_id" , "name" , "group_id" , "source"  FROM "_mra__profiles_skills"      ) SELECT  json_build_object($108, (SELECT  COUNT(*)  FROM "_aca__profiles_skills"      ) ) , (SELECT  coalesce(bool_and("check__constraint" ), $109 )  FROM "_mra__profiles_skills"      )
5 min 0.6% 152 ms 1,943 postgres
SELECT id as record_id,
       ROW_NUMBER() OVER (ORDER BY best_score DESC, id) as rank
FROM (
  SELECT id, MAX(score) as best_score
  FROM (
    SELECT id, paradedb.score(id) as score
    FROM profiles
    WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($1), paradedb.term($2, $3)])
      
      AND deleted_at IS NULL
      
      
      
    ORDER BY paradedb.score(id) DESC
    LIMIT $4
    OFFSET $5
  ) topk
  GROUP BY id
) sub
ORDER BY rank
LIMIT $6
5 min 0.6% 147 ms 2,001 postgres
WITH
all_matched_count AS (
  SELECT count(*) as cnt
  FROM profiles p
  
  
  WHERE p.deleted_at IS NULL
  AND p.group_id = $1::uuid
  
  AND EXISTS (SELECT $2 FROM profiles_statuses_cache psc WHERE psc.profile_id = p.id AND psc.group_id = $3::uuid AND psc.is_talent = $4)
  
),
all_matched AS (
  SELECT p.id as id
  FROM profiles p
  
  
  
  WHERE p.deleted_at IS NULL
  AND p.group_id = $5::uuid
  
  AND EXISTS (SELECT $6 FROM profiles_statuses_cache psc WHERE psc.profile_id = p.id AND psc.group_id = $7::uuid AND psc.is_talent = $8)
  
  ORDER BY p.trigger_last_interaction_date DESC NULLS LAST, p.id ASC
  LIMIT $9 OFFSET $10
)
SELECT json_build_object(
  $11, (SELECT COALESCE(json_agg(id), $12::json) FROM all_matched),
  $13, (SELECT cnt FROM all_matched_count),
  $14, $15::json
)::text as result
5 min 0.6% 62 ms 4,601 nhost_hasura
SELECT  coalesce(json_agg("root" ), $3 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."project_id" AS "projectId", "_root.base"."statuses_metrics" AS "statusesMetrics", $4 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public"."projects_statuses_metrics"  WHERE (("public"."projects_statuses_metrics"."id") = ANY(($2)::uuid[]))     ) AS "_root.base"      ) AS "_root"
5 min 0.6% 29 ms 9,348 nhost_hasura
WITH "_mutres__historyentries" AS (INSERT INTO "public"."historyentries" ( "user_id", "deleted_at", "type", "external_id", "sender_user_id", "created_at", "message", "profile_id", "group_id", "external_thread_id", "data" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::text, ($4)::text, ($5)::uuid, ($6)::timestamptz, ($7)::text, ($8)::uuid, ($9)::uuid, ($10)::text, ($11)::jsonb) ON CONFLICT ON CONSTRAINT "historyentries_external_id_user_id_profile_id_key" DO UPDATE SET "type" = EXCLUDED."type","external_id" = EXCLUDED."external_id","sender_user_id" = EXCLUDED."sender_user_id","created_at" = EXCLUDED."created_at","message" = EXCLUDED."message","profile_id" = EXCLUDED."profile_id","external_thread_id" = EXCLUDED."external_thread_id","data" = EXCLUDED."data" WHERE (((((("public"."historyentries"."group_id") = (($12)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($13)::uuid) IS NULL))) AND ($14)) AND ($15)) AND ($16)) RETURNING * , CASE WHEN ("public"."historyentries"."xmax") = ($17) THEN ((((((("public"."historyentries"."group_id") = (($18)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($19)::uuid) IS NULL))) AND ($20)) AND ($21)) AND (((EXISTS  (SELECT  $22  FROM "public"."profiles" AS "_be_0_profiles" WHERE (((("_be_0_profiles"."id") = ("public"."historyentries"."profile_id")) AND ($23)) AND (($24) AND ((((("_be_0_profiles"."group_id") = (($25)::uuid)) OR ((("_be_0_profiles"."group_id") IS NULL) AND ((($26)::uuid) IS NULL))) AND ($27)) AND ($28))))     )) AND ($29)) AND ($30))) AND ($31))::boolean ELSE ((((("public"."historyentries"."group_id") = (($32)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($33)::uuid) IS NULL))) AND ($34)) AND ($35))::boolean END AS "check__constraint") SELECT  json_build_object($36, (SELECT  COUNT(*)  FROM "_mutres__historyentries"      ), $37, (SELECT  coalesce(json_agg("root" ), $38 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  ("_root.base"."id")::text AS "id", ("_root.base"."created_at")::text AS "created_at", ("_root.base"."updated_at")::text AS "updated_at", ("_root.base"."deleted_at")::text AS "deleted_at", ("_root.base"."profile_id")::text AS "profile_id", ("_root.base"."user_id")::text AS "user_id", ("_root.base"."type")::text AS "type", ("_root.base"."data")::text AS "data", ("_root.base"."message")::text AS "message", ("_root.base"."metadata")::text AS "metadata", ("_root.base"."subject")::text AS "subject", ("_root.base"."external_id")::text AS "external_id", ("_root.base"."external_thread_id")::text AS "external_thread_id", ("_root.base"."event_start_at")::text AS "event_start_at", ("_root.base"."event_end_at")::text AS "event_end_at", ("_root.base"."emailAddress")::text AS "emailAddress", ("_root.base"."sender_user_id")::text AS "sender_user_id", ("_root.base"."linkedin_seat_id")::text AS "linkedin_seat_id", ("_root.base"."is_manually_created")::text AS "is_manually_created", ("_root.base"."project_id")::text AS "project_id", ("_root.base"."message_scheduled_id")::text AS "message_scheduled_id", ("_root.base"."jobboard_offer_id")::text AS "jobboard_offer_id", ("_root.base"."group_id")::text AS "group_id", ("_root.base"."trigger_occurred_at")::text AS "trigger_occurred_at", ("_root.base"."source")::text AS "source", ("_root.base"."should_notify_jobboard_on_change")::text AS "should_notify_jobboard_on_change", ("_root.base"."sub_type_id")::text AS "sub_type_id", ("_root.base"."tags")::text AS "tags", ("_root.base"."phone_number")::text AS "phone_number", ("_root.base"."is_merged_from_id")::text AS "is_merged_from_id", ("_root.base"."recording_id")::text AS "recording_id", ("_root.base"."draft_created_at")::text AS "draft_created_at", ("_root.base"."oauth_account_id")::text AS "oauth_account_id"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_mutres__historyentries" WHERE ($39)     ) AS "_root.base"      ) AS "_root"      ) ) , (SELECT  coalesce(bool_and("check__constraint" ), $40 )  FROM "_mutres__historyentries"      )
4 min 0.5% 28 ms 9,567 nhost_hasura
WITH "_mra__historyentries" AS (INSERT INTO "public"."historyentries" ( "user_id", "deleted_at", "type", "external_id", "created_at", "profile_id", "group_id" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::text, ($4)::text, ($5)::timestamptz, $6, ($7)::uuid) ON CONFLICT ON CONSTRAINT "historyentries_external_id_user_id_profile_id_key" DO UPDATE SET "deleted_at" = EXCLUDED."deleted_at" WHERE (((((("public"."historyentries"."group_id") = (($8)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($9)::uuid) IS NULL))) AND ($10)) AND ($11)) AND ($12)) RETURNING * , CASE WHEN ("public"."historyentries"."xmax") = ($13) THEN ((((((("public"."historyentries"."group_id") = (($14)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($15)::uuid) IS NULL))) AND ($16)) AND ($17)) AND (((EXISTS  (SELECT  $18  FROM "public"."profiles" AS "_be_0_profiles" WHERE (((("_be_0_profiles"."id") = ("public"."historyentries"."profile_id")) AND ($19)) AND (($20) AND ((((("_be_0_profiles"."group_id") = (($21)::uuid)) OR ((("_be_0_profiles"."group_id") IS NULL) AND ((($22)::uuid) IS NULL))) AND ($23)) AND ($24))))     )) AND ($25)) AND ($26))) AND ($27))::boolean ELSE ((((("public"."historyentries"."group_id") = (($28)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($29)::uuid) IS NULL))) AND ($30)) AND ($31))::boolean END AS "check__constraint"), "_aca__historyentries" AS (SELECT  "id" , "created_at" , "updated_at" , "deleted_at" , "profile_id" , "user_id" , "type" , "data" , "message" , "metadata" , "subject" , "external_id" , "external_thread_id" , "event_start_at" , "event_end_at" , "emailAddress" , "sender_user_id" , "linkedin_seat_id" , "is_manually_created" , "project_id" , "message_scheduled_id" , "jobboard_offer_id" , "group_id" , "trigger_occurred_at" , "source" , "should_notify_jobboard_on_change" , "sub_type_id" , "tags" , "phone_number" , "is_merged_from_id" , "recording_id" , "draft_created_at" , "oauth_account_id"  FROM "_mra__historyentries"      ) SELECT  json_build_object($32, (SELECT  COUNT(*)  FROM "_aca__historyentries"      ) ) , (SELECT  coalesce(bool_and("check__constraint" ), $33 )  FROM "_mra__historyentries"      )
4 min 0.5% 128 ms 1,941 postgres
SELECT profile_id as record_id,
       ROW_NUMBER() OVER (ORDER BY best_score DESC, profile_id) as rank
FROM (
  SELECT profile_id, MAX(score) as best_score
  FROM (
    SELECT profile_id, paradedb.score(id) as score
    FROM profiles_skills
    WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($1), paradedb.term($2, $3)])
      
      AND deleted_at IS NULL
      AND profile_id IS NOT NULL
      
      
    ORDER BY paradedb.score(id) DESC
    LIMIT $4
    OFFSET $5
  ) topk
  GROUP BY profile_id
) sub
ORDER BY rank
LIMIT $6
4 min 0.5% 162 ms 1,406 postgres
SELECT DISTINCT sub.record_id, $1 as rank
FROM (
  SELECT profile_id as record_id
  FROM profiles_educations
  WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($2), paradedb.term($3, $4)])
    
    AND deleted_at IS NULL
    AND profile_id IS NOT NULL
    
    
  LIMIT $5
) sub
4 min 0.4% 65 ms 3,303 nhost_hasura
SELECT  coalesce(json_agg("root" ORDER BY "root.pg.created_at" DESC NULLS LAST, "root.pg.id" ASC NULLS LAST), $4 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."created_at" AS "createdAt", "_root.base"."updated_at" AS "updatedAt", "_root.base"."deleted_at" AS "deletedAt", "_root.base"."read_at" AS "readAt", "_root.base"."type" AS "type", "_root.base"."user_id" AS "userId", "_root.or.profile"."profile" AS "profile", "_root.or.messageScheduled"."messageScheduled" AS "messageScheduled", "_root.or.historyEntry"."historyEntry" AS "historyEntry", $5 AS "__typename"       ) AS "_e"      ) ) AS "root", "_root.base"."created_at" AS "root.pg.created_at", "_root.base"."id" AS "root.pg.id" FROM  (SELECT  *  FROM "public"."notifications"  WHERE ((("public"."notifications"."group_id") = ((($1->>$6))::uuid)) AND ((("public"."notifications"."deleted_at") IS NULL) AND ((("public"."notifications"."type") = (($2)::text)) AND (((("public"."notifications"."deleted_at") IS NULL) AND (EXISTS  (SELECT  $7  FROM "public"."profiles" AS "__be_0_profiles" WHERE (((("__be_0_profiles"."id") = ("public"."notifications"."profile_id")) AND ($8)) AND (((((("__be_0_profiles"."group_id") = ((($1->>$9))::uuid)) OR ((("__be_0_profiles"."group_id") IS NULL) AND (((($1->>$10))::uuid) IS NULL))) AND ($11)) AND ($12)) AND (((("__be_0_profiles"."deleted_at") IS NULL) AND ($13)) AND ($14))))     ))) AND ((("public"."notifications"."user_id") = (($3)::uuid)) AND (("public"."notifications"."read_at") IS NULL))))))   ORDER BY "created_at" DESC NULLS LAST, "id" ASC NULLS LAST LIMIT $15 OFFSET $16) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.messageScheduled.base"."id" AS "id", "_root.or.messageScheduled.base"."deleted_at" AS "deletedAt", "_root.or.messageScheduled.base"."is_draft" AS "isDraft", "_root.or.messageScheduled.base"."subject" AS "subject", "_root.or.messageScheduled.base"."text_message" AS "textMessage", "_root.or.messageScheduled.base"."type" AS "type", $17 AS "__typename"       ) AS "_e"      ) ) AS "messageScheduled" FROM  (SELECT  *  FROM "public"."messages_scheduled"  WHERE ((("_root.base"."message_scheduled_id") = ("id")) AND (("public"."messages_scheduled"."group_id") = ((($1->>$18))::uuid)))    LIMIT $19 ) AS "_root.or.messageScheduled.base"      ) AS "_root.or.messageScheduled" ON ($20) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.base"."id" AS "id", "_root.or.historyEntry.base"."type" AS "type", "_root.or.historyEntry.base"."trigger_occurred_at" AS "occurredAt", "_root.or.historyEntry.base"."source" AS "source", "public"."historyentries_message_with_confidentiality_settings"("_root.or.historyEntry.base", "hasura_session" => $1)  AS "messageWithConfidentialitySettings", "public"."historyentries_subject_with_confidentiality_settings"("_root.or.historyEntry.base", "hasura_session" => $1)  AS "subjectWithConfidentialitySettings", "_root.or.historyEntry.or.project"."project" AS "project", "_root.or.historyEntry.ar.historyEntry.files"."files" AS "files", $21 AS "__typename"       ) AS "_e"      ) ) AS "historyEntry" FROM  (SELECT  *  FROM "public"."historyentries"  WHERE ((("_root.base"."historyentry_id") = ("id")) AND ((("public"."historyentries"."group_id") = ((($1->>$22))::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND (((($1->>$23))::uuid) IS NULL))))    LIMIT $24 ) AS "_root.or.historyEntry.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.or.project.base"."id" AS "id", "_root.or.historyEntry.or.project.base"."name" AS "name", "_root.or.historyEntry.or.project.or.company"."company" AS "company", $25 AS "__typename"       ) AS "_e"      ) ) AS "project" FROM  (SELECT  *  FROM "public"."projects"  WHERE ((("_root.or.historyEntry.base"."project_id") = ("id")) AND ((("public"."projects"."group_id") = ((($1->>$26))::uuid)) OR ((("public"."projects"."group_id") IS NULL) AND (((($1->>$27))::uuid) IS NULL))))    LIMIT $28 ) AS "_root.or.historyEntry.or.project.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.or.project.or.company.base"."id" AS "id", "md5_077948e7bbff295097ff401783cb3f33__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData"."linkedinCompanyData" AS "linkedinCompanyData", $29 AS "__typename"       ) AS "_e"      ) ) AS "company" FROM  (SELECT  *  FROM "public"."companies"  WHERE ((("_root.or.historyEntry.or.project.base"."company_id") = ("id")) AND (("public"."companies"."group_id") = ((($1->>$30))::uuid)))    LIMIT $31 ) AS "_root.or.historyEntry.or.project.or.company.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "md5_17543089adf72f49b3baaef6b1428de7__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.base"."id" AS "id", "md5_17543089adf72f49b3baaef6b1428de7__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.base"."name" AS "name", "md5_842292468fab93732a798efc38bc0209__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image"."image" AS "image", $32 AS "__typename"       ) AS "_e"      ) ) AS "linkedinCompanyData" FROM  (SELECT  *  FROM "public"."linkedin_companies_data"  WHERE (("_root.or.historyEntry.or.project.or.company.base"."linkedin_company_id") = ("id"))    LIMIT $33 ) AS "md5_17543089adf72f49b3baaef6b1428de7__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "md5_ec3723e1a27bd9103837f6711a574140__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image.base"."id" AS "id", "md5_ec3723e1a27bd9103837f6711a574140__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image.base"."file_id" AS "fileId", "md5_ec3723e1a27bd9103837f6711a574140__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image.base"."public_url" AS "publicUrl", $34 AS "__typename"       ) AS "_e"      ) ) AS "image" FROM  (SELECT  *  FROM "public"."images"  WHERE (("md5_17543089adf72f49b3baaef6b1428de7__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.base"."image_id") = ("id"))    LIMIT $35 ) AS "md5_ec3723e1a27bd9103837f6711a574140__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image.base"      ) AS "md5_842292468fab93732a798efc38bc0209__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData.or.image" ON ($36)      ) AS "md5_077948e7bbff295097ff401783cb3f33__root.or.historyEntry.or.project.or.company.or.linkedinCompanyData" ON ($37)      ) AS "_root.or.historyEntry.or.project.or.company" ON ($38)      ) AS "_root.or.historyEntry.or.project" ON ($39) LEFT OUTER JOIN LATERAL (SELECT  (SELECT  coalesce(json_agg("_sub_query"."files" ORDER BY "ob_col_1" ASC NULLS LAST), $40 )  FROM  (SELECT  "_unnest_table"."files" AS "files", "_unnest_table"."ob_col_1" AS "ob_col_1" FROM UNNEST(array_agg("files" ), array_agg("root.or.historyEntry.ar.historyEntry.files.pg.created_at" )) AS "_unnest_table"("files", "ob_col_1")    ORDER BY "ob_col_1" ASC NULLS LAST LIMIT $41 ) AS "_sub_query"      ) AS "files" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.ar.historyEntry.files.base"."file_id" AS "fileId", "_root.or.historyEntry.ar.historyEntry.files.base"."created_at" AS "createdAt", "_root.or.historyEntry.ar.historyEntry.files.base"."updated_at" AS "updatedAt", "_root.or.historyEntry.ar.historyEntry.files.or.file"."file" AS "file", $42 AS "__typename"       ) AS "_e"      ) ) AS "files", "_root.or.historyEntry.ar.historyEntry.files.base"."created_at" AS "root.or.historyEntry.ar.historyEntry.files.pg.created_at" FROM  (SELECT  *  FROM "public"."historyentries_files"  WHERE ((("_root.or.historyEntry.base"."id") = ("historyentry_id")) AND ((EXISTS  (SELECT  $43  FROM "public"."historyentries" AS "__be_0_historyentries" WHERE (((("__be_0_historyentries"."id") = ("public"."historyentries_files"."historyentry_id")) AND ($44)) AND (($45) AND ((((("__be_0_historyentries"."group_id") = ((($1->>$46))::uuid)) OR ((("__be_0_historyentries"."group_id") IS NULL) AND (((($1->>$47))::uuid) IS NULL))) AND ($48)) AND ($49))))     )) AND (("public"."historyentries_files"."deleted_at") IS NULL)))   ORDER BY "created_at" ASC NULLS LAST  ) AS "_root.or.historyEntry.ar.historyEntry.files.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.historyEntry.ar.historyEntry.files.or.file.base"."id" AS "id", "_root.or.historyEntry.ar.historyEntry.files.or.file.base"."name" AS "name", "_root.or.historyEntry.ar.historyEntry.files.or.file.base"."size" AS "size", "_root.or.historyEntry.ar.historyEntry.files.or.file.base"."mime_type" AS "mimeType", $50 AS "__typename"       ) AS "_e"      ) ) AS "file" FROM  (SELECT  *  FROM "storage"."files"  WHERE (("_root.or.historyEntry.ar.historyEntry.files.base"."file_id") = ("id"))    LIMIT $51 ) AS "_root.or.historyEntry.ar.historyEntry.files.or.file.base"      ) AS "_root.or.historyEntry.ar.historyEntry.files.or.file" ON ($52)    ORDER BY "root.or.historyEntry.ar.historyEntry.files.pg.created_at" ASC NULLS LAST  ) AS "_root.or.historyEntry.ar.historyEntry.files"      ) AS "_root.or.historyEntry.ar.historyEntry.files" ON ($53)      ) AS "_root.or.historyEntry" ON ($54) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.profile.base"."id" AS "id", "_root.or.profile.base"."trigger_first_name" AS "firstName", "_root.or.profile.base"."trigger_last_name" AS "lastName", "_root.or.profile.base"."source" AS "source", "_root.or.profile.or.image"."image" AS "image", "_root.or.profile.ar.profile.files"."files" AS "files", "_root.or.profile.base"."status_id" AS "statusId", "_root.or.profile.base"."is_contact" AS "isContact", "_root.or.profile.base"."is_talent" AS "isTalent", "_root.or.profile
3 min 0.4% 98 ms 1,884 nhost_hasura
WITH "_cte_projects_recently_used_0" AS (SELECT 
    p.group_id as "groupId",
    p.id,
    p.linkedin_id AS "linkedinId",
    p.is_made_for_sales as "isMadeForSales",
    p.is_made_for_recruitment as "isMadeForRecruitment",
    COALESCE(pa.max, p.created_at) AS max,
    p.name AS name,
    c.trigger_name AS "companyName",
    p.status_id AS "statusId",
    p.color_id AS "colorId",
    CASE 
        WHEN c.id IS NOT NULL THEN 
            jsonb_build_object(
                $16, c.id,
                $17, c.trigger_name,
                $18, c.linkedin_company_id,
                $19, CASE 
                    WHEN ci.public_url IS NOT NULL THEN 
                        jsonb_build_object($20, ci.public_url)
                    ELSE $21 
                END,
                $22, CASE 
                    WHEN lcd.id IS NOT NULL THEN 
                        jsonb_build_object(
                            $23, lcd.id,
                            $24, lcd.name,
                            $25, CASE 
                                WHEN lcdi.public_url IS NOT NULL THEN 
                                    jsonb_build_object($26, lcdi.public_url)
                                ELSE $27 
                            END
                        )
                    ELSE $28 
                END
            )
        ELSE $29 
    END AS company
FROM projects p
LEFT JOIN (
    SELECT 
        project_id, 
        MAX(created_at) as max
    FROM profiles_associations
    WHERE user_id = ($2)::uuid::uuid
      AND trigger_is_applicant IS NOT TRUE 
      AND project_id IS NOT NULL 
      AND association_type = $30
      AND deleted_at IS NULL
    GROUP BY project_id
) pa ON pa.project_id = p.id
LEFT JOIN companies c ON c.id = p.company_id
LEFT JOIN images ci ON ci.id = c.image_id
LEFT JOIN linkedin_companies_data lcd ON lcd.id = c.linkedin_company_id
LEFT JOIN images lcdi ON lcdi.id = lcd.image_id
WHERE p.deleted_at IS NULL
  AND p.group_id = ($3)::uuid::uuid
  AND (($4)::boolean IS NULL OR ($5)::boolean = p.is_made_for_sales)
  AND (($6)::boolean IS NULL OR ($7)::boolean = p.is_made_for_recruitment)
  AND (
      -- case no search
      (
        (($8)::text IS NULL OR LENGTH(($9)::text) < $31)
        AND (
            pa.project_id IS NOT NULL
            OR EXISTS (
                SELECT $32 
                FROM projects_assignees pja 
                WHERE pja.project_id = p.id 
                  AND pja.user_id = ($10)::uuid::uuid
            )
        )
      )
      -- case search
      OR (
        (($11)::text IS NOT NULL AND LENGTH(($12)::text) >= $33)
        AND p.trigger_search_name ILIKE $34 || ($13)::text || $35
      )
  )
  AND (
    ($14)::boolean IS NOT TRUE
    OR EXISTS (
      SELECT $36 FROM projects_assignees pja
      WHERE pja.project_id = p.id AND pja.user_id = ($15)::uuid::uuid
    )
  )
ORDER BY COALESCE(pa.max, p.created_at) DESC
LIMIT $37
) SELECT  coalesce(json_agg("root" ), $38 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."groupId" AS "groupId", "_root.base"."id" AS "id", "_root.base"."linkedinId" AS "linkedinId", "_root.base"."isMadeForSales" AS "isMadeForSales", "_root.base"."isMadeForRecruitment" AS "isMadeForRecruitment", "_root.base"."max" AS "max", "_root.base"."name" AS "name", "_root.base"."companyName" AS "companyName", "_root.base"."company" AS "company", "_root.base"."statusId" AS "statusId", "_root.base"."colorId" AS "colorId", $39 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_cte_projects_recently_used_0" WHERE (("_cte_projects_recently_used_0"."groupId") = ((($1->>$40))::uuid))     ) AS "_root.base"      ) AS "_root"
3 min 0.3% 38 ms 4,327 nhost_hasura
SELECT  coalesce(json_agg("root" ORDER BY "root.pg.created_at" DESC NULLS FIRST), $4 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."created_at" AS "createdAt", "_root.base"."updated_at" AS "updatedAt", "_root.base"."external_id" AS "externalId", "_root.base"."reference_id" AS "referenceId", "_root.base"."trigger_short_id" AS "shortId", "_root.base"."name" AS "name", "_root.ar.root.fieldsValues"."fieldsValues" AS "fieldsValues", "_root.ar.root.projectJobBoards"."projectJobBoards" AS "projectJobBoards", "_root.ar.root.assignees"."assignees" AS "assignees", $5 AS "__typename"       ) AS "_e"      ) ) AS "root", "_root.base"."created_at" AS "root.pg.created_at" FROM  (SELECT  *  FROM "public"."projects"  WHERE (((("public"."projects"."group_id") = ((($1->>$6))::uuid)) OR ((("public"."projects"."group_id") IS NULL) AND (((($1->>$7))::uuid) IS NULL))) AND (("public"."projects"."id") = ANY(($3)::uuid[])))   ORDER BY "created_at" DESC NULLS FIRST LIMIT $8 ) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  coalesce(json_agg("fieldsValues" ), $9 ) AS "fieldsValues" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.fieldsValues.base"."id" AS "id", "_root.ar.root.fieldsValues.or.field"."field" AS "field", "_root.ar.root.fieldsValues.or.fieldValue"."fieldValue" AS "fieldValue", "_root.ar.root.fieldsValues.or.location"."location" AS "location", "_root.ar.root.fieldsValues.base"."value" AS "value", $10 AS "__typename"       ) AS "_e"      ) ) AS "fieldsValues" FROM  (SELECT  *  FROM "public"."projects_fieldsvalues"  WHERE ((("_root.base"."id") = ("project_id")) AND ((("public"."projects_fieldsvalues"."group_id") = ((($1->>$11))::uuid)) AND ((("public"."projects_fieldsvalues"."deleted_at") IS NULL) AND (((("public"."projects_fieldsvalues"."fieldvalue_id") IS NULL) OR (EXISTS  (SELECT  $12  FROM "public"."fieldsvalues" AS "__be_0_fieldsvalues" WHERE (((("__be_0_fieldsvalues"."id") = ("public"."projects_fieldsvalues"."fieldvalue_id")) AND ($13)) AND (($14) AND (((("__be_0_fieldsvalues"."deleted_at") IS NULL) AND ($15)) AND ($16))))     ))) AND (EXISTS  (SELECT  $17  FROM "public"."fields" AS "__be_1_fields" WHERE (((("__be_1_fields"."id") = ("public"."projects_fieldsvalues"."field_id")) AND ($18)) AND (((((("__be_1_fields"."group_id") = ((($1->>$19))::uuid)) OR ((("__be_1_fields"."group_id") IS NULL) AND (((($1->>$20))::uuid) IS NULL))) AND ($21)) AND ($22)) AND (((("__be_1_fields"."deleted_at") IS NULL) AND ($23)) AND ($24))))     ))))))     ) AS "_root.ar.root.fieldsValues.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.fieldsValues.or.location.base"."id" AS "id", "_root.ar.root.fieldsValues.or.location.base"."search" AS "search", "_root.ar.root.fieldsValues.or.location.base"."locality" AS "locality", "_root.ar.root.fieldsValues.or.location.base"."postal_code" AS "postalCode", "_root.ar.root.fieldsValues.or.location.base"."administrative_area_level_2" AS "administrativeAreaLevel2", "_root.ar.root.fieldsValues.or.location.base"."administrative_area_level_1" AS "administrativeAreaLevel1", "_root.ar.root.fieldsValues.or.location.base"."country_name" AS "countryName", "_root.ar.root.fieldsValues.or.location.base"."country_short_name" AS "countryShortName", "_root.ar.root.fieldsValues.or.location.base"."formatted_address" AS "formattedAddress", $25 AS "__typename"       ) AS "_e"      ) ) AS "location" FROM  (SELECT  *  FROM "public"."locations"  WHERE (("_root.ar.root.fieldsValues.base"."location_id") = ("id"))    LIMIT $26 ) AS "_root.ar.root.fieldsValues.or.location.base"      ) AS "_root.ar.root.fieldsValues.or.location" ON ($27) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.fieldsValues.or.field.base"."id" AS "id", "_root.ar.root.fieldsValues.or.field.base"."type" AS "type", "_root.ar.root.fieldsValues.or.field.base"."name" AS "name", "_root.ar.root.fieldsValues.or.field.base"."purpose" AS "purpose", "_root.ar.root.fieldsValues.or.field.base"."is_public" AS "isPublic", "_root.ar.root.fieldsValues.or.field.base"."order" AS "order", $28 AS "__typename"       ) AS "_e"      ) ) AS "field" FROM  (SELECT  *  FROM "public"."fields"  WHERE ((("_root.ar.root.fieldsValues.base"."field_id") = ("id")) AND ((("public"."fields"."group_id") = ((($1->>$29))::uuid)) OR ((("public"."fields"."group_id") IS NULL) AND (((($1->>$30))::uuid) IS NULL))))    LIMIT $31 ) AS "_root.ar.root.fieldsValues.or.field.base"      ) AS "_root.ar.root.fieldsValues.or.field" ON ($32) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.fieldsValues.or.fieldValue.base"."id" AS "id", "_root.ar.root.fieldsValues.or.fieldValue.base"."name" AS "name", "_root.ar.root.fieldsValues.or.fieldValue.base"."technical_value" AS "technicalValue", $33 AS "__typename"       ) AS "_e"      ) ) AS "fieldValue" FROM  (SELECT  *  FROM "public"."fieldsvalues"  WHERE (("_root.ar.root.fieldsValues.base"."fieldvalue_id") = ("id"))    LIMIT $34 ) AS "_root.ar.root.fieldsValues.or.fieldValue.base"      ) AS "_root.ar.root.fieldsValues.or.fieldValue" ON ($35)      ) AS "_root.ar.root.fieldsValues"      ) AS "_root.ar.root.fieldsValues" ON ($36) LEFT OUTER JOIN LATERAL (SELECT  (SELECT  coalesce(json_agg("_sub_query"."projectJobBoards" ), $37 )  FROM  (SELECT  "_unnest_table"."projectJobBoards" AS "projectJobBoards" FROM UNNEST(array_agg("projectJobBoards" )) AS "_unnest_table"("projectJobBoards")     LIMIT $38 ) AS "_sub_query"      ) AS "projectJobBoards" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.projectJobBoards.base"."enabled_at" AS "enabledAt", $39 AS "__typename"       ) AS "_e"      ) ) AS "projectJobBoards" FROM  (SELECT  *  FROM "public"."projects_jobboards"  WHERE ((("_root.base"."id") = ("project_id")) AND ((EXISTS  (SELECT  $40  FROM "public"."projects" AS "__be_0_projects" WHERE (((("__be_0_projects"."id") = ("public"."projects_jobboards"."project_id")) AND ($41)) AND (($42) AND ((((("__be_0_projects"."group_id") = ((($1->>$43))::uuid)) OR ((("__be_0_projects"."group_id") IS NULL) AND (((($1->>$44))::uuid) IS NULL))) AND ($45)) AND ($46))))     )) AND (("public"."projects_jobboards"."jobboard_id") = (($2)::uuid))))     ) AS "_root.ar.root.projectJobBoards.base"      ) AS "_root.ar.root.projectJobBoards"      ) AS "_root.ar.root.projectJobBoards" ON ($47) LEFT OUTER JOIN LATERAL (SELECT  coalesce(json_agg("assignees" ), $48 ) AS "assignees" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.assignees.base"."id" AS "id", "_root.ar.root.assignees.or.user"."user" AS "user", $49 AS "__typename"       ) AS "_e"      ) ) AS "assignees" FROM  (SELECT  *  FROM "public"."projects_assignees"  WHERE ((("_root.base"."id") = ("project_id")) AND (("public"."projects_assignees"."deleted_at") IS NULL))     ) AS "_root.ar.root.assignees.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.assignees.or.user.base"."display_name" AS "displayName", "_root.ar.root.assignees.or.user.base"."email" AS "email", "_root.ar.root.assignees.or.user.base"."id" AS "id", $50 AS "__typename"       ) AS "_e"      ) ) AS "user" FROM  (SELECT  *  FROM "auth"."users"  WHERE ((("_root.ar.root.assignees.base"."user_id") = ("id")) AND ((EXISTS  (SELECT  $51  FROM "public"."users_groups" AS "__be_0_users_groups" WHERE (((("__be_0_users_groups"."user_id") = ("auth"."users"."id")) AND ($52)) AND (($53) AND (((("__be_0_users_groups"."group_id") = ((($1->>$54))::uuid)) AND ($55)) AND ($56))))     )) OR (("auth"."users"."id") = ((($1->>$57))::uuid))))    LIMIT $58 ) AS "_root.ar.root.assignees.or.user.base"      ) AS "_root.ar.root.assignees.or.user" ON ($59)      ) AS "_root.ar.root.assignees"      ) AS "_root.ar.root.assignees" ON ($60)    ORDER BY "root.pg.created_at" DESC NULLS FIRST  ) AS "_root"
2 min 0.3% 106 ms 1,401 postgres
SELECT DISTINCT sub.record_id, $1 as rank
FROM (
  SELECT profile_id as record_id
  FROM profiles_skills
  WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($2), paradedb.term($3, $4)])
    
    AND deleted_at IS NULL
    AND profile_id IS NOT NULL
    
    
  LIMIT $5
) sub
2 min 0.3% 74 ms 1,939 postgres
SELECT profile_id as record_id,
       ROW_NUMBER() OVER (ORDER BY best_score DESC, profile_id) as rank
FROM (
  SELECT profile_id, MAX(score) as best_score
  FROM (
    SELECT profile_id, paradedb.score(id) as score
    FROM profiles_fieldsvalues
    WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($1), paradedb.term($2, $3)])
      
      AND deleted_at IS NULL
      AND profile_id IS NOT NULL
      
      
    ORDER BY paradedb.score(id) DESC
    LIMIT $4
    OFFSET $5
  ) topk
  GROUP BY profile_id
) sub
ORDER BY rank
LIMIT $6
2 min 0.3% 152 ms 935 nhost_hasura
SELECT  coalesce(json_agg("root" ORDER BY "root.pg.trigger_occurred_at" DESC NULLS LAST, "root.pg.id" ASC NULLS LAST), $6 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."created_at" AS "createdAt", "_root.base"."trigger_occurred_at" AS "occurredAt", "_root.base"."updated_at" AS "updatedAt", "_root.base"."deleted_at" AS "deletedAt", "_root.base"."profile_id" AS "profileId", "_root.base"."user_id" AS "userId", "_root.base"."type" AS "type", "_root.base"."message" AS "message", "_root.base"."metadata" AS "metadata", "_root.base"."subject" AS "subject", "_root.base"."external_id" AS "externalId", "_root.base"."external_thread_id" AS "externalThreadId", "_root.base"."event_start_at" AS "eventStartAt", "_root.base"."event_end_at" AS "eventEndAt", "_root.base"."emailAddress" AS "emailAddress", "_root.base"."phone_number" AS "phoneNumber", "_root.base"."oauth_account_id" AS "oauthAccountId", "_root.base"."sender_user_id" AS "senderUserId", "_root.base"."linkedin_seat_id" AS "linkedinSeatId", "_root.base"."is_manually_created" AS "isManuallyCreated", "_root.base"."project_id" AS "projectId", "_root.base"."message_scheduled_id" AS "messageScheduledId", "public"."historyentries_subject_with_confidentiality_settings"("_root.base", "hasura_session" => $1)  AS "subjectWithConfidentialitySettings", "public"."historyentries_message_with_confidentiality_settings"("_root.base", "hasura_session" => $1)  AS "messageWithConfidentialitySettings", "public"."historyentries_data_with_confidentiality_settings"("_root.base", "hasura_session" => $1)  AS "dataWithConfidentialitySettings", "public"."historyentries_is_confidential_with_confidentiality_settings"("_root.base", "hasura_session" => $1)  AS "isConfidential", "_root.base"."jobboard_offer_id" AS "jobBoardOfferId", "public"."historyentries_is_invitation_reply_email"("_root.base")  AS "isInvitationReplyEmail", "_root.base"."source" AS "source", "_root.base"."should_notify_jobboard_on_change" AS "shouldNotifyJobBoardOnChange", "_root.base"."tags" AS "tags", "_root.or.subType"."subType" AS "subType", "_root.or.profile"."profile" AS "profile", "_root.or.jobBoardsOffer"."jobBoardsOffer" AS "jobBoardsOffer", "_root.or.project"."project" AS "project", "_root.or.user"."user" AS "user", "_root.or.sender"."sender" AS "sender", "_root.or.recording"."recording" AS "recording", "_root.ar.root.files"."files" AS "files", $7 AS "__typename"       ) AS "_e"      ) ) AS "root", "_root.base"."trigger_occurred_at" AS "root.pg.trigger_occurred_at", "_root.base"."id" AS "root.pg.id" FROM  (SELECT  *  FROM "public"."historyentries"  WHERE (((("public"."historyentries"."group_id") = ((($1->>$8))::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND (((($1->>$9))::uuid) IS NULL))) AND ((("public"."historyentries"."deleted_at") IS NULL) AND (((("public"."historyentries"."project_id") = (($2)::uuid)) OR ((("public"."historyentries"."project_id") IS NULL) OR (EXISTS  (SELECT  $10  FROM "public"."mentions" AS "__be_0_mentions" WHERE (((("__be_0_mentions"."source_id") = ("public"."historyentries"."id")) AND ($11)) AND ((((("__be_0_mentions"."group_id") = ((($1->>$12))::uuid)) AND ($13)) AND ($14)) AND (((("__be_0_mentions"."target_type") = (($3)::text)) AND ($15)) AND (((("__be_0_mentions"."deleted_at") IS NULL) AND ($16)) AND (((("__be_0_mentions"."target_id") = (($4)::uuid)) AND ($17)) AND ($18))))))     )))) AND (("public"."historyentries"."project_id") = (($5)::uuid)))))   ORDER BY "trigger_occurred_at" DESC NULLS LAST, "id" ASC NULLS LAST LIMIT $19 OFFSET $20) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.sender.base"."id" AS "id", "_root.or.sender.base"."display_name" AS "displayName", $21 AS "__typename"       ) AS "_e"      ) ) AS "sender" FROM  (SELECT  *  FROM "auth"."users"  WHERE ((("_root.base"."sender_user_id") = ("id")) AND ((EXISTS  (SELECT  $22  FROM "public"."users_groups" AS "__be_0_users_groups" WHERE (((("__be_0_users_groups"."user_id") = ("auth"."users"."id")) AND ($23)) AND (($24) AND (((("__be_0_users_groups"."group_id") = ((($1->>$25))::uuid)) AND ($26)) AND ($27))))     )) OR (("auth"."users"."id") = ((($1->>$28))::uuid))))    LIMIT $29 ) AS "_root.or.sender.base"      ) AS "_root.or.sender" ON ($30) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.subType.base"."id" AS "id", "_root.or.subType.base"."name" AS "name", "_root.or.subType.base"."color" AS "color", "_root.or.subType.base"."type" AS "type", $31 AS "__typename"       ) AS "_e"      ) ) AS "subType" FROM  (SELECT  *  FROM "public"."historyentries_subtypes"  WHERE ((("_root.base"."sub_type_id") = ("id")) AND (("public"."historyentries_subtypes"."group_id") = ((($1->>$32))::uuid)))    LIMIT $33 ) AS "_root.or.subType.base"      ) AS "_root.or.subType" ON ($34) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.project.base"."id" AS "id", "_root.or.project.base"."color_id" AS "colorId", "_root.or.project.base"."name" AS "name", "_root.or.project.base"."deleted_at" AS "deletedAt", $35 AS "__typename"       ) AS "_e"      ) ) AS "project" FROM  (SELECT  *  FROM "public"."projects"  WHERE ((("_root.base"."project_id") = ("id")) AND ((("public"."projects"."group_id") = ((($1->>$36))::uuid)) OR ((("public"."projects"."group_id") IS NULL) AND (((($1->>$37))::uuid) IS NULL))))    LIMIT $38 ) AS "_root.or.project.base"      ) AS "_root.or.project" ON ($39) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.user.base"."id" AS "id", "_root.or.user.base"."display_name" AS "displayName", $40 AS "__typename"       ) AS "_e"      ) ) AS "user" FROM  (SELECT  *  FROM "auth"."users"  WHERE ((("_root.base"."user_id") = ("id")) AND ((EXISTS  (SELECT  $41  FROM "public"."users_groups" AS "__be_0_users_groups" WHERE (((("__be_0_users_groups"."user_id") = ("auth"."users"."id")) AND ($42)) AND (($43) AND (((("__be_0_users_groups"."group_id") = ((($1->>$44))::uuid)) AND ($45)) AND ($46))))     )) OR (("auth"."users"."id") = ((($1->>$47))::uuid))))    LIMIT $48 ) AS "_root.or.user.base"      ) AS "_root.or.user" ON ($49) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.profile.base"."trigger_first_name" AS "firstName", "_root.or.profile.base"."trigger_last_name" AS "lastName", "_root.or.profile.or.image"."image" AS "image", "_root.or.profile.base"."is_contact" AS "isContact", "_root.or.profile.base"."is_talent" AS "isTalent", $50 AS "__typename"       ) AS "_e"      ) ) AS "profile" FROM  (SELECT  *  FROM "public"."profiles"  WHERE ((("_root.base"."profile_id") = ("id")) AND ((("public"."profiles"."group_id") = ((($1->>$51))::uuid)) OR ((("public"."profiles"."group_id") IS NULL) AND (((($1->>$52))::uuid) IS NULL))))    LIMIT $53 ) AS "_root.or.profile.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.profile.or.image.base"."public_url" AS "publicUrl", $54 AS "__typename"       ) AS "_e"      ) ) AS "image" FROM  (SELECT  *  FROM "public"."images"  WHERE (("_root.or.profile.base"."image_id") = ("id"))    LIMIT $55 ) AS "_root.or.profile.or.image.base"      ) AS "_root.or.profile.or.image" ON ($56)      ) AS "_root.or.profile" ON ($57) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.jobBoardsOffer.base"."id" AS "id", "_root.or.jobBoardsOffer.base"."external_id" AS "externalId", "_root.or.jobBoardsOffer.base"."reference_id" AS "referenceId", "_root.or.jobBoardsOffer.base"."name" AS "name", "_root.or.jobBoardsOffer.or.jobBoard"."jobBoard" AS "jobBoard", $58 AS "__typename"       ) AS "_e"      ) ) AS "jobBoardsOffer" FROM  (SELECT  *  FROM "public"."jobboards_offers"  WHERE ((("_root.base"."jobboard_offer_id") = ("id")) AND (("public"."jobboards_offers"."group_id") = ((($1->>$59))::uuid)))    LIMIT $60 ) AS "_root.or.jobBoardsOffer.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.jobBoardsOffer.or.jobBoard.base"."id" AS "id", "_root.or.jobBoardsOffer.or.jobBoard.base"."name" AS "name", $61 AS "__typename"       ) AS "_e"      ) ) AS "jobBoard" FROM  (SELECT  *  FROM "public"."jobboards"  WHERE ((("_root.or.jobBoardsOffer.base"."jobboard_id") = ("id")) AND ((("public"."jobboards"."group_id") IS NULL) OR ((("public"."jobboards"."group_id") = ((($1->>$62))::uuid)) OR ((("public"."jobboards"."group_id") IS NULL) AND (((($1->>$63))::uuid) IS NULL)))))    LIMIT $64 ) AS "_root.or.jobBoardsOffer.or.jobBoard.base"      ) AS "_root.or.jobBoardsOffer.or.jobBoard" ON ($65)      ) AS "_root.or.jobBoardsOffer" ON ($66) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.recording.base"."id" AS "id", "_root.or.recording.base"."summary" AS "summary", "_root.or.recording.base"."duration_seconds" AS "durationSeconds", "_root.or.recording.base"."error_code" AS "errorCode", "_root.or.recording.base"."error_message" AS "errorMessage", $67 AS "__typename"       ) AS "_e"      ) ) AS "recording" FROM  (SELECT  *  FROM "public"."recordings"  WHERE ((("_root.base"."recording_id") = ("id")) AND ((("public"."recordings"."deleted_at") IS NULL) AND ((("public"."recordings"."user_id") = ((($1->>$68))::uuid)) OR (("public"."recordings"."group_id") = ((($1->>$69))::uuid)))))    LIMIT $70 ) AS "_root.or.recording.base"      ) AS "_root.or.recording" ON ($71) LEFT OUTER JOIN LATERAL (SELECT  (SELECT  coalesce(json_agg("_sub_query"."files" ORDER BY "ob_col_1" ASC NULLS LAST), $72 )  FROM  (SELECT  "_unnest_table"."files" AS "files", "_unnest_table"."ob_col_1" AS "ob_col_1" FROM UNNEST(array_agg("files" ), array_agg("root.ar.root.files.pg.created_at" )) AS "_unnest_table"("files", "ob_col_1")    ORDER BY "ob_col_1" ASC NULLS LAST LIMIT $73 ) AS "_sub_query"      ) AS "files" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.files.base"."file_id" AS "fileId
2 min 0.3% 28 ms 5,067 nhost_hasura
SELECT  coalesce(json_agg("root" ORDER BY "root.pg.user_id" ASC NULLS LAST, "root.pg.done_at" DESC NULLS FIRST), $5 ) AS "root" FROM  (SELECT DISTINCT ON ("root.pg.user_id") row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."done_at" AS "doneAt", "_root.base"."user_id" AS "userId", "_root.or.user"."user" AS "user", $6 AS "__typename"       ) AS "_e"      ) ) AS "root", "_root.base"."done_at" AS "root.pg.done_at", "_root.base"."user_id" AS "root.pg.user_id" FROM  (SELECT DISTINCT ON ("user_id") *  FROM "public"."tasks"  WHERE (((("public"."tasks"."deleted_at") IS NULL) AND ((("public"."tasks"."group_id") = ((($1->>$7))::uuid)) OR ((("public"."tasks"."group_id") IS NULL) AND (((($1->>$8))::uuid) IS NULL)))) AND ((("public"."tasks"."deleted_at") IS NULL) AND ((("public"."tasks"."status") = (($2)::text)) AND ((("public"."tasks"."type") = ANY(($3)::text[])) AND (("public"."tasks"."project_id") = (($4)::uuid))))))   ORDER BY "user_id" ASC NULLS LAST, "done_at" DESC NULLS FIRST LIMIT $9 ) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.user.base"."display_name" AS "displayName", $10 AS "__typename"       ) AS "_e"      ) ) AS "user" FROM  (SELECT  *  FROM "auth"."users"  WHERE ((("_root.base"."user_id") = ("id")) AND ((EXISTS  (SELECT  $11  FROM "public"."users_groups" AS "__be_0_users_groups" WHERE (((("__be_0_users_groups"."user_id") = ("auth"."users"."id")) AND ($12)) AND (($13) AND (((("__be_0_users_groups"."group_id") = ((($1->>$14))::uuid)) AND ($15)) AND ($16))))     )) OR (("auth"."users"."id") = ((($1->>$17))::uuid))))    LIMIT $18 ) AS "_root.or.user.base"      ) AS "_root.or.user" ON ($19)    ORDER BY "root.pg.user_id" ASC NULLS LAST, "root.pg.done_at" DESC NULLS FIRST  ) AS "_root"
2 min 0.3% 67 ms 2,021 postgres
SELECT record_id,
       ROW_NUMBER() OVER (ORDER BY score DESC, record_id) as rank
FROM (SELECT pfv.profile_id as record_id, MAX(bm25.score) as score
      FROM (
        SELECT fv.id as fv_id, paradedb.score(fv.id) as score
        FROM fieldsvalues fv
        WHERE fv.id @@@ pdb.parse($1)
          AND fv.deleted_at IS NULL
        OFFSET $2
      ) bm25
      JOIN profiles_fieldsvalues pfv ON pfv.fieldvalue_id = bm25.fv_id
        AND pfv.group_id = $3::uuid
        AND pfv.deleted_at IS NULL
      GROUP BY pfv.profile_id) sub
ORDER BY rank
LIMIT $4
2 min 0.3% 67 ms 2,024 nhost_hasura
WITH "_mra__historyentries" AS (INSERT INTO "public"."historyentries" ( "user_id", "deleted_at", "type", "oauth_account_id", "external_id", "created_at", "subject", "emailAddress", "message", "profile_id", "group_id", "external_thread_id" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::text, ($4)::text, ($5)::text, ($6)::timestamptz, ($7)::text, ($8)::text, ($9)::text, ($10)::uuid, ($11)::uuid, ($12)::text) ON CONFLICT ON CONSTRAINT "historyentries_external_id_user_id_profile_id_key" DO UPDATE SET "type" = EXCLUDED."type","oauth_account_id" = EXCLUDED."oauth_account_id","external_id" = EXCLUDED."external_id","created_at" = EXCLUDED."created_at","subject" = EXCLUDED."subject","emailAddress" = EXCLUDED."emailAddress","message" = EXCLUDED."message","profile_id" = EXCLUDED."profile_id","external_thread_id" = EXCLUDED."external_thread_id" WHERE (((((("public"."historyentries"."group_id") = (($13)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($14)::uuid) IS NULL))) AND ($15)) AND ($16)) AND ($17)) RETURNING * , CASE WHEN ("public"."historyentries"."xmax") = ($18) THEN ((((((("public"."historyentries"."group_id") = (($19)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($20)::uuid) IS NULL))) AND ($21)) AND ($22)) AND (((EXISTS  (SELECT  $23  FROM "public"."profiles" AS "_be_0_profiles" WHERE (((("_be_0_profiles"."id") = ("public"."historyentries"."profile_id")) AND ($24)) AND (($25) AND ((((("_be_0_profiles"."group_id") = (($26)::uuid)) OR ((("_be_0_profiles"."group_id") IS NULL) AND ((($27)::uuid) IS NULL))) AND ($28)) AND ($29))))     )) AND ($30)) AND ($31))) AND ($32))::boolean ELSE ((((("public"."historyentries"."group_id") = (($33)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($34)::uuid) IS NULL))) AND ($35)) AND ($36))::boolean END AS "check__constraint"), "_aca__historyentries" AS (SELECT  "id" , "created_at" , "updated_at" , "deleted_at" , "profile_id" , "user_id" , "type" , "data" , "message" , "metadata" , "subject" , "external_id" , "external_thread_id" , "event_start_at" , "event_end_at" , "emailAddress" , "sender_user_id" , "linkedin_seat_id" , "is_manually_created" , "project_id" , "message_scheduled_id" , "jobboard_offer_id" , "group_id" , "trigger_occurred_at" , "source" , "should_notify_jobboard_on_change" , "sub_type_id" , "tags" , "phone_number" , "is_merged_from_id" , "recording_id" , "draft_created_at" , "oauth_account_id"  FROM "_mra__historyentries"      ) SELECT  json_build_object($37, (SELECT  COUNT(*)  FROM "_aca__historyentries"      ), $38, (SELECT  coalesce(json_agg("root" ), $39 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", $40 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_aca__historyentries" WHERE ($41)     ) AS "_root.base"      ) AS "_root"      ), $42, $43 ) , (SELECT  coalesce(bool_and("check__constraint" ), $44 )  FROM "_mra__historyentries"      )
2 min 0.3% 384 ms 340 postgres
SELECT record_id,
       ROW_NUMBER() OVER (ORDER BY score DESC, record_id) as rank
FROM (SELECT c.id as record_id, MAX(bm25.score) as score
    FROM (
      SELECT lcd.id as lcd_id, paradedb.score(lcd.id) as score
      FROM linkedin_companies_data lcd
      WHERE lcd.id @@@ pdb.parse($1)
        AND lcd.deleted_at IS NULL
      OFFSET $2
    ) bm25
    JOIN companies c ON c.linkedin_company_id = bm25.lcd_id AND c.deleted_at IS NULL
    WHERE c.group_id = $3::uuid
    GROUP BY c.id) sub
ORDER BY rank
LIMIT $4
2 min 0.3% 56 ms 2,225 nhost_hasura
SELECT  coalesce(json_agg("root" ), $7 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."talent_identifier" AS "talentIdentifier", "_root.ar.root.applicationsForThisProject"."applicationsForThisProject" AS "applicationsForThisProject", $8 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public"."profiles"  WHERE (((("public"."profiles"."group_id") = ((($1->>$9))::uuid)) OR ((("public"."profiles"."group_id") IS NULL) AND (((($1->>$10))::uuid) IS NULL))) AND ((("public"."profiles"."deleted_at") IS NULL) AND ((EXISTS  (SELECT  $11  FROM "public"."profiles_associations" AS "__be_0_profiles_associations" WHERE (((("__be_0_profiles_associations"."profile_id") = ("public"."profiles"."id")) AND ($12)) AND ((((("__be_0_profiles_associations"."group_id") = ((($1->>$13))::uuid)) AND ($14)) AND ($15)) AND (((("__be_0_profiles_associations"."deleted_at") IS NULL) AND ($16)) AND (((("__be_0_profiles_associations"."project_id") = (($4)::uuid)) AND ($17)) AND (((("__be_0_profiles_associations"."association_type") = (($5)::text)) AND ($18)) AND ($19))))))     )) AND (("public"."profiles"."talent_identifier") = ANY(($6)::text[])))))     ) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  json_build_object($20, json_build_object($21, COUNT(*), $22, $23 ), $24, coalesce($25, (bool_or($26))::text ) ) AS "applicationsForThisProject" FROM  (SELECT  $27  FROM  (SELECT  *  FROM "public"."historyentries"  WHERE ((("_root.base"."id") = ("profile_id")) AND (((("public"."historyentries"."group_id") = ((($1->>$28))::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND (((($1->>$29))::uuid) IS NULL))) AND ((("public"."historyentries"."deleted_at") IS NULL) AND ((("public"."historyentries"."type") = (($2)::text)) AND (("public"."historyentries"."project_id") = (($3)::uuid))))))     ) AS "_root.ar.root.applicationsForThisProject.base"      ) AS "_root.ar.root.applicationsForThisProject"      ) AS "_root.ar.root.applicationsForThisProject" ON ($30)      ) AS "_root"
2 min 0.2% 66 ms 1,763 nhost_hasura
WITH "_mra__historyentries" AS (INSERT INTO "public"."historyentries" ( "user_id", "deleted_at", "type", "external_id", "sender_user_id", "created_at", "message", "profile_id", "group_id", "external_thread_id", "data" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::text, ($4)::text, ($5)::uuid, ($6)::timestamptz, ($7)::text, ($8)::uuid, ($9)::uuid, ($10)::text, ($11)::jsonb) ON CONFLICT ON CONSTRAINT "historyentries_external_id_user_id_profile_id_key" DO UPDATE SET "type" = EXCLUDED."type","external_id" = EXCLUDED."external_id","sender_user_id" = EXCLUDED."sender_user_id","created_at" = EXCLUDED."created_at","message" = EXCLUDED."message","profile_id" = EXCLUDED."profile_id","external_thread_id" = EXCLUDED."external_thread_id","data" = EXCLUDED."data" WHERE (((((("public"."historyentries"."group_id") = (($12)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($13)::uuid) IS NULL))) AND ($14)) AND ($15)) AND ($16)) RETURNING * , CASE WHEN ("public"."historyentries"."xmax") = ($17) THEN ((((((("public"."historyentries"."group_id") = (($18)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($19)::uuid) IS NULL))) AND ($20)) AND ($21)) AND (((EXISTS  (SELECT  $22  FROM "public"."profiles" AS "_be_0_profiles" WHERE (((("_be_0_profiles"."id") = ("public"."historyentries"."profile_id")) AND ($23)) AND (($24) AND ((((("_be_0_profiles"."group_id") = (($25)::uuid)) OR ((("_be_0_profiles"."group_id") IS NULL) AND ((($26)::uuid) IS NULL))) AND ($27)) AND ($28))))     )) AND ($29)) AND ($30))) AND ($31))::boolean ELSE ((((("public"."historyentries"."group_id") = (($32)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($33)::uuid) IS NULL))) AND ($34)) AND ($35))::boolean END AS "check__constraint"), "_aca__historyentries" AS (SELECT  "id" , "created_at" , "updated_at" , "deleted_at" , "profile_id" , "user_id" , "type" , "data" , "message" , "metadata" , "subject" , "external_id" , "external_thread_id" , "event_start_at" , "event_end_at" , "emailAddress" , "sender_user_id" , "linkedin_seat_id" , "is_manually_created" , "project_id" , "message_scheduled_id" , "jobboard_offer_id" , "group_id" , "trigger_occurred_at" , "source" , "should_notify_jobboard_on_change" , "sub_type_id" , "tags" , "phone_number" , "is_merged_from_id" , "recording_id" , "draft_created_at" , "oauth_account_id"  FROM "_mra__historyentries"      ) SELECT  json_build_object($36, (SELECT  COUNT(*)  FROM "_aca__historyentries"      ), $37, (SELECT  coalesce(json_agg("root" ), $38 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", $39 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_aca__historyentries" WHERE ($40)     ) AS "_root.base"      ) AS "_root"      ), $41, $42 ) , (SELECT  coalesce(bool_and("check__constraint" ), $43 )  FROM "_mra__historyentries"      )
2 min 0.2% 40 ms 2,874 nhost_hasura
WITH "_mra__profiles_associations" AS (INSERT INTO "public"."profiles_associations" ( "user_id", "deleted_at", "project_id", "association_type", "status_id", "profile_id", "group_id" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::uuid, ($4)::text, ($5)::uuid, ($6)::uuid, ($7)::uuid) ON CONFLICT ON CONSTRAINT "profiles_projects_pkey" DO UPDATE SET "deleted_at" = EXCLUDED."deleted_at","status_id" = EXCLUDED."status_id" WHERE ((((("public"."profiles_associations"."group_id") = (($8)::uuid)) AND ($9)) AND ($10)) AND ($11)) RETURNING * , CASE WHEN ("public"."profiles_associations"."xmax") = ($12) THEN ((((EXISTS  (SELECT  $13  FROM "public"."projects" AS "_be_0_projects" WHERE (((("_be_0_projects"."id") = ("public"."profiles_associations"."project_id")) AND ($14)) AND (($15) AND ((((("_be_0_projects"."group_id") = (($16)::uuid)) OR ((("_be_0_projects"."group_id") IS NULL) AND ((($17)::uuid) IS NULL))) AND ($18)) AND ($19))))     )) AND ($20)) OR (((EXISTS  (SELECT  $21  FROM "public"."companies" AS "_be_1_companies" WHERE (((("_be_1_companies"."id") = ("public"."profiles_associations"."company_id")) AND ($22)) AND (($23) AND (((("_be_1_companies"."group_id") = (($24)::uuid)) AND ($25)) AND ($26))))     )) AND ($27)) OR ($28))) AND ($29))::boolean ELSE (((("public"."profiles_associations"."group_id") = (($30)::uuid)) AND ($31)) AND ($32))::boolean END AS "check__constraint"), "_aca__profiles_associations" AS (SELECT  "profile_id" , "project_id" , "updated_at" , "deleted_at" , "status_id" , "created_at" , "user_id" , "trigger_count_connexions_with_this_profile" , "trigger_count_invitations_scheduled_to_this_profile" , "trigger_count_messages_scheduled_to_this_profile" , "trigger_count_invitations_sent_to_this_profile" , "trigger_count_applications_from_this_profile" , "trigger_count_meetings_done_with_this_profile" , "trigger_count_meetings_scheduled_with_this_profile" , "trigger_count_messages_received_from_this_profile" , "trigger_count_messages_sent_to_this_profile" , "trigger_first_interaction_date" , "trigger_last_interaction_date" , "trigger_status_auto_id" , "trigger_last_interaction_type" , "trigger_count_resumes" , "company_id" , "trigger_external_id" , "association_type" , "source" , "id" , "trigger_is_applicant" , "group_id" , "is_merged_from_id" , "updated_by_user_id" , "updated_status_at"  FROM "_mra__profiles_associations"      ) SELECT  json_build_object($33, (SELECT  COUNT(*)  FROM "_aca__profiles_associations"      ), $34, (SELECT  coalesce(json_agg("root" ), $35 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."project_id" AS "projectId", "_root.base"."company_id" AS "companyId", "_root.base"."profile_id" AS "profileId", "_root.base"."deleted_at" AS "deletedAt", $36 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_aca__profiles_associations" WHERE ($37)     ) AS "_root.base"      ) AS "_root"      ), $38, $39 ) , (SELECT  coalesce(bool_and("check__constraint" ), $40 )  FROM "_mra__profiles_associations"      )
2 min 0.2% 45 ms 2,309 nhost_hasura
WITH "_mra__historyentries" AS (INSERT INTO "public"."historyentries" ( "user_id", "deleted_at", "linkedin_seat_id", "type", "external_id", "created_at", "subject", "tags", "message", "profile_id", "group_id", "external_thread_id", "data" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::integer, ($4)::text, ($5)::text, ($6)::timestamptz, ($7)::text, ($8)::jsonb, ($9)::text, ($10)::uuid, ($11)::uuid, ($12)::text, ($13)::jsonb) ON CONFLICT ON CONSTRAINT "historyentries_external_id_user_id_profile_id_key" DO UPDATE SET "linkedin_seat_id" = EXCLUDED."linkedin_seat_id","type" = EXCLUDED."type","external_id" = EXCLUDED."external_id","created_at" = EXCLUDED."created_at","subject" = EXCLUDED."subject","tags" = EXCLUDED."tags","message" = EXCLUDED."message","profile_id" = EXCLUDED."profile_id","external_thread_id" = EXCLUDED."external_thread_id","data" = EXCLUDED."data" WHERE (((((("public"."historyentries"."group_id") = (($14)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($15)::uuid) IS NULL))) AND ($16)) AND ($17)) AND ($18)) RETURNING * , CASE WHEN ("public"."historyentries"."xmax") = ($19) THEN ((((((("public"."historyentries"."group_id") = (($20)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($21)::uuid) IS NULL))) AND ($22)) AND ($23)) AND (((EXISTS  (SELECT  $24  FROM "public"."profiles" AS "_be_0_profiles" WHERE (((("_be_0_profiles"."id") = ("public"."historyentries"."profile_id")) AND ($25)) AND (($26) AND ((((("_be_0_profiles"."group_id") = (($27)::uuid)) OR ((("_be_0_profiles"."group_id") IS NULL) AND ((($28)::uuid) IS NULL))) AND ($29)) AND ($30))))     )) AND ($31)) AND ($32))) AND ($33))::boolean ELSE ((((("public"."historyentries"."group_id") = (($34)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($35)::uuid) IS NULL))) AND ($36)) AND ($37))::boolean END AS "check__constraint"), "_aca__historyentries" AS (SELECT  "id" , "created_at" , "updated_at" , "deleted_at" , "profile_id" , "user_id" , "type" , "data" , "message" , "metadata" , "subject" , "external_id" , "external_thread_id" , "event_start_at" , "event_end_at" , "emailAddress" , "sender_user_id" , "linkedin_seat_id" , "is_manually_created" , "project_id" , "message_scheduled_id" , "jobboard_offer_id" , "group_id" , "trigger_occurred_at" , "source" , "should_notify_jobboard_on_change" , "sub_type_id" , "tags" , "phone_number" , "is_merged_from_id" , "recording_id" , "draft_created_at" , "oauth_account_id"  FROM "_mra__historyentries"      ) SELECT  json_build_object($38, (SELECT  COUNT(*)  FROM "_aca__historyentries"      ), $39, (SELECT  coalesce(json_agg("root" ), $40 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", $41 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_aca__historyentries" WHERE ($42)     ) AS "_root.base"      ) AS "_root"      ), $43, $44 ) , (SELECT  coalesce(bool_and("check__constraint" ), $45 )  FROM "_mra__historyentries"      )
2 min 0.2% 34 ms 2,857 nhost_hasura
SELECT  coalesce(json_agg("root" ), $7 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."created_at" AS "createdAt", "_root.base"."row_id" AS "rowId", "_root.base"."table_name" AS "tableName", "_root.base"."old_value" AS "oldValue", "_root.base"."new_value" AS "newValue", "_root.base"."profile_id" AS "profileId", "_root.or.profile"."profile" AS "profile", "_root.or.project"."project" AS "project", $8 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public"."audit_logs"  WHERE (((("public"."audit_logs"."group_id") = ((($1->>$9))::uuid)) OR ((("public"."audit_logs"."group_id") IS NULL) AND (((($1->>$10))::uuid) IS NULL))) AND ((("public"."audit_logs"."user_id") = (($2)::uuid)) AND ((("public"."audit_logs"."deleted_at") IS NULL) AND ((("public"."audit_logs"."table_name") = (($3)::text)) AND ((("public"."audit_logs"."created_at") >= (($4)::timestamptz)) AND ((("public"."audit_logs"."new_value") @> (($5)::jsonb)) AND ((EXISTS  (SELECT  $11  FROM "public"."profiles" AS "__be_0_profiles" WHERE (((("__be_0_profiles"."id") = ("public"."audit_logs"."profile_id")) AND ($12)) AND (((((("__be_0_profiles"."group_id") = ((($1->>$13))::uuid)) OR ((("__be_0_profiles"."group_id") IS NULL) AND (((($1->>$14))::uuid) IS NULL))) AND ($15)) AND ($16)) AND (((("__be_0_profiles"."deleted_at") IS NULL) AND ($17)) AND ((EXISTS  (SELECT  $18  FROM "public"."profiles_associations" AS "__be_1_profiles_associations" WHERE (((("__be_1_profiles_associations"."profile_id") = ("__be_0_profiles"."id")) AND ($19)) AND ((((("__be_1_profiles_associations"."group_id") = ((($1->>$20))::uuid)) AND ($21)) AND ($22)) AND (((("__be_1_profiles_associations"."deleted_at") IS NULL) AND ($23)) AND (((("__be_1_profiles_associations"."status_id") = (($6)::uuid)) AND ($24)) AND ($25)))))     )) AND ($26)))))     )) AND (EXISTS  (SELECT  $27  FROM "public"."projects" AS "__be_2_projects" WHERE (((("__be_2_projects"."id") = ("public"."audit_logs"."project_id")) AND ($28)) AND (((((("__be_2_projects"."group_id") = ((($1->>$29))::uuid)) OR ((("__be_2_projects"."group_id") IS NULL) AND (((($1->>$30))::uuid) IS NULL))) AND ($31)) AND ($32)) AND (((("__be_2_projects"."deleted_at") IS NULL) AND ($33)) AND ($34))))     )))))))))    LIMIT $35 ) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.project.base"."id" AS "id", "_root.or.project.base"."name" AS "name", $36 AS "__typename"       ) AS "_e"      ) ) AS "project" FROM  (SELECT  *  FROM "public"."projects"  WHERE ((("_root.base"."project_id") = ("id")) AND ((("public"."projects"."group_id") = ((($1->>$37))::uuid)) OR ((("public"."projects"."group_id") IS NULL) AND (((($1->>$38))::uuid) IS NULL))))    LIMIT $39 ) AS "_root.or.project.base"      ) AS "_root.or.project" ON ($40) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.profile.base"."id" AS "id", "_root.or.profile.base"."trigger_first_name" AS "firstName", "_root.or.profile.base"."trigger_last_name" AS "lastName", $41 AS "__typename"       ) AS "_e"      ) ) AS "profile" FROM  (SELECT  *  FROM "public"."profiles"  WHERE ((("_root.base"."profile_id") = ("id")) AND ((("public"."profiles"."group_id") = ((($1->>$42))::uuid)) OR ((("public"."profiles"."group_id") IS NULL) AND (((($1->>$43))::uuid) IS NULL))))    LIMIT $44 ) AS "_root.or.profile.base"      ) AS "_root.or.profile" ON ($45)      ) AS "_root"
2 min 0.2% 41 ms 2,325 nhost_hasura
WITH "_mra__campains_profiles" AS (INSERT INTO "public"."campains_profiles" ( "campain_id", "profile_id" ) VALUES ($1, ($2)::uuid)  RETURNING * , ((((EXISTS  (SELECT  $3  FROM "public"."campains" AS "_be_0_campains" WHERE (((("_be_0_campains"."id") = ("public"."campains_profiles"."campain_id")) AND ($4)) AND (($5) AND ((EXISTS  (SELECT  $6  FROM "auth"."users" AS "_be_1_auth_users" WHERE (((("_be_1_auth_users"."id") = ("_be_0_campains"."user_id")) AND ($7)) AND (($8) AND ((EXISTS  (SELECT  $9  FROM "public"."users_groups" AS "_be_2_users_groups" WHERE (((("_be_2_users_groups"."user_id") = ("_be_1_auth_users"."id")) AND ($10)) AND (($11) AND (((("_be_2_users_groups"."group_id") = (($12)::uuid)) AND ($13)) AND ($14))))     )) AND ($15))))     )) AND ($16))))     )) AND ($17)) AND (((EXISTS  (SELECT  $18  FROM "public"."profiles" AS "_be_3_profiles" WHERE (((("_be_3_profiles"."id") = ("public"."campains_profiles"."profile_id")) AND ($19)) AND (($20) AND ((((("_be_3_profiles"."group_id") = (($21)::uuid)) OR ((("_be_3_profiles"."group_id") IS NULL) AND ((($22)::uuid) IS NULL))) AND ($23)) AND ($24))))     )) AND ($25)) AND ($26))) AND ($27))::boolean AS "check__constraint"), "_aca__campains_profiles" AS (SELECT  "campain_id" , "profile_id" , "created_at" , "updated_at" , "id" , "deleted_at"  FROM "_mra__campains_profiles"      ) SELECT  json_build_object($28, (SELECT  COUNT(*)  FROM "_aca__campains_profiles"      ) ) , (SELECT  coalesce(bool_and("check__constraint" ), $29 )  FROM "_mra__campains_profiles"      )
2 min 0.2% 103 ms 878 nhost_hasura
SELECT  coalesce(json_agg("root" ORDER BY "root.pg.trigger_occurred_at" DESC NULLS LAST, "root.pg.id" ASC NULLS LAST), $6 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", "_root.base"."created_at" AS "createdAt", "_root.base"."trigger_occurred_at" AS "occurredAt", "_root.base"."updated_at" AS "updatedAt", "_root.base"."deleted_at" AS "deletedAt", "_root.base"."profile_id" AS "profileId", "_root.base"."user_id" AS "userId", "_root.base"."type" AS "type", "_root.base"."message" AS "message", "_root.base"."metadata" AS "metadata", "_root.base"."subject" AS "subject", "_root.base"."external_id" AS "externalId", "_root.base"."external_thread_id" AS "externalThreadId", "_root.base"."event_start_at" AS "eventStartAt", "_root.base"."event_end_at" AS "eventEndAt", "_root.base"."emailAddress" AS "emailAddress", "_root.base"."phone_number" AS "phoneNumber", "_root.base"."oauth_account_id" AS "oauthAccountId", "_root.base"."sender_user_id" AS "senderUserId", "_root.base"."linkedin_seat_id" AS "linkedinSeatId", "_root.base"."is_manually_created" AS "isManuallyCreated", "_root.base"."project_id" AS "projectId", "_root.base"."message_scheduled_id" AS "messageScheduledId", "public"."historyentries_subject_with_confidentiality_settings"("_root.base", "hasura_session" => $1)  AS "subjectWithConfidentialitySettings", "public"."historyentries_message_with_confidentiality_settings"("_root.base", "hasura_session" => $1)  AS "messageWithConfidentialitySettings", "public"."historyentries_data_with_confidentiality_settings"("_root.base", "hasura_session" => $1)  AS "dataWithConfidentialitySettings", "public"."historyentries_is_confidential_with_confidentiality_settings"("_root.base", "hasura_session" => $1)  AS "isConfidential", "_root.base"."jobboard_offer_id" AS "jobBoardOfferId", "public"."historyentries_is_invitation_reply_email"("_root.base")  AS "isInvitationReplyEmail", "_root.base"."source" AS "source", "_root.base"."should_notify_jobboard_on_change" AS "shouldNotifyJobBoardOnChange", "_root.base"."tags" AS "tags", "_root.or.subType"."subType" AS "subType", "_root.or.profile"."profile" AS "profile", "_root.or.jobBoardsOffer"."jobBoardsOffer" AS "jobBoardsOffer", "_root.or.project"."project" AS "project", "_root.or.user"."user" AS "user", "_root.or.sender"."sender" AS "sender", "_root.or.recording"."recording" AS "recording", "_root.ar.root.files"."files" AS "files", $7 AS "__typename"       ) AS "_e"      ) ) AS "root", "_root.base"."trigger_occurred_at" AS "root.pg.trigger_occurred_at", "_root.base"."id" AS "root.pg.id" FROM  (SELECT  *  FROM "public"."historyentries"  WHERE (((("public"."historyentries"."group_id") = ((($1->>$8))::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND (((($1->>$9))::uuid) IS NULL))) AND ((("public"."historyentries"."deleted_at") IS NULL) AND (((("public"."historyentries"."project_id") = (($2)::uuid)) OR ((("public"."historyentries"."project_id") IS NULL) OR (EXISTS  (SELECT  $10  FROM "public"."mentions" AS "__be_0_mentions" WHERE (((("__be_0_mentions"."source_id") = ("public"."historyentries"."id")) AND ($11)) AND ((((("__be_0_mentions"."group_id") = ((($1->>$12))::uuid)) AND ($13)) AND ($14)) AND (((("__be_0_mentions"."target_type") = (($3)::text)) AND ($15)) AND (((("__be_0_mentions"."deleted_at") IS NULL) AND ($16)) AND (((("__be_0_mentions"."target_id") = (($4)::uuid)) AND ($17)) AND ($18))))))     )))) AND (("public"."historyentries"."profile_id") = ANY(($5)::uuid[])))))   ORDER BY "trigger_occurred_at" DESC NULLS LAST, "id" ASC NULLS LAST LIMIT $19 OFFSET $20) AS "_root.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.sender.base"."id" AS "id", "_root.or.sender.base"."display_name" AS "displayName", $21 AS "__typename"       ) AS "_e"      ) ) AS "sender" FROM  (SELECT  *  FROM "auth"."users"  WHERE ((("_root.base"."sender_user_id") = ("id")) AND ((EXISTS  (SELECT  $22  FROM "public"."users_groups" AS "__be_0_users_groups" WHERE (((("__be_0_users_groups"."user_id") = ("auth"."users"."id")) AND ($23)) AND (($24) AND (((("__be_0_users_groups"."group_id") = ((($1->>$25))::uuid)) AND ($26)) AND ($27))))     )) OR (("auth"."users"."id") = ((($1->>$28))::uuid))))    LIMIT $29 ) AS "_root.or.sender.base"      ) AS "_root.or.sender" ON ($30) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.subType.base"."id" AS "id", "_root.or.subType.base"."name" AS "name", "_root.or.subType.base"."color" AS "color", "_root.or.subType.base"."type" AS "type", $31 AS "__typename"       ) AS "_e"      ) ) AS "subType" FROM  (SELECT  *  FROM "public"."historyentries_subtypes"  WHERE ((("_root.base"."sub_type_id") = ("id")) AND (("public"."historyentries_subtypes"."group_id") = ((($1->>$32))::uuid)))    LIMIT $33 ) AS "_root.or.subType.base"      ) AS "_root.or.subType" ON ($34) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.project.base"."id" AS "id", "_root.or.project.base"."color_id" AS "colorId", "_root.or.project.base"."name" AS "name", "_root.or.project.base"."deleted_at" AS "deletedAt", $35 AS "__typename"       ) AS "_e"      ) ) AS "project" FROM  (SELECT  *  FROM "public"."projects"  WHERE ((("_root.base"."project_id") = ("id")) AND ((("public"."projects"."group_id") = ((($1->>$36))::uuid)) OR ((("public"."projects"."group_id") IS NULL) AND (((($1->>$37))::uuid) IS NULL))))    LIMIT $38 ) AS "_root.or.project.base"      ) AS "_root.or.project" ON ($39) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.user.base"."id" AS "id", "_root.or.user.base"."display_name" AS "displayName", $40 AS "__typename"       ) AS "_e"      ) ) AS "user" FROM  (SELECT  *  FROM "auth"."users"  WHERE ((("_root.base"."user_id") = ("id")) AND ((EXISTS  (SELECT  $41  FROM "public"."users_groups" AS "__be_0_users_groups" WHERE (((("__be_0_users_groups"."user_id") = ("auth"."users"."id")) AND ($42)) AND (($43) AND (((("__be_0_users_groups"."group_id") = ((($1->>$44))::uuid)) AND ($45)) AND ($46))))     )) OR (("auth"."users"."id") = ((($1->>$47))::uuid))))    LIMIT $48 ) AS "_root.or.user.base"      ) AS "_root.or.user" ON ($49) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.profile.base"."trigger_first_name" AS "firstName", "_root.or.profile.base"."trigger_last_name" AS "lastName", "_root.or.profile.or.image"."image" AS "image", "_root.or.profile.base"."is_contact" AS "isContact", "_root.or.profile.base"."is_talent" AS "isTalent", $50 AS "__typename"       ) AS "_e"      ) ) AS "profile" FROM  (SELECT  *  FROM "public"."profiles"  WHERE ((("_root.base"."profile_id") = ("id")) AND ((("public"."profiles"."group_id") = ((($1->>$51))::uuid)) OR ((("public"."profiles"."group_id") IS NULL) AND (((($1->>$52))::uuid) IS NULL))))    LIMIT $53 ) AS "_root.or.profile.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.profile.or.image.base"."public_url" AS "publicUrl", $54 AS "__typename"       ) AS "_e"      ) ) AS "image" FROM  (SELECT  *  FROM "public"."images"  WHERE (("_root.or.profile.base"."image_id") = ("id"))    LIMIT $55 ) AS "_root.or.profile.or.image.base"      ) AS "_root.or.profile.or.image" ON ($56)      ) AS "_root.or.profile" ON ($57) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.jobBoardsOffer.base"."id" AS "id", "_root.or.jobBoardsOffer.base"."external_id" AS "externalId", "_root.or.jobBoardsOffer.base"."reference_id" AS "referenceId", "_root.or.jobBoardsOffer.base"."name" AS "name", "_root.or.jobBoardsOffer.or.jobBoard"."jobBoard" AS "jobBoard", $58 AS "__typename"       ) AS "_e"      ) ) AS "jobBoardsOffer" FROM  (SELECT  *  FROM "public"."jobboards_offers"  WHERE ((("_root.base"."jobboard_offer_id") = ("id")) AND (("public"."jobboards_offers"."group_id") = ((($1->>$59))::uuid)))    LIMIT $60 ) AS "_root.or.jobBoardsOffer.base" LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.jobBoardsOffer.or.jobBoard.base"."id" AS "id", "_root.or.jobBoardsOffer.or.jobBoard.base"."name" AS "name", $61 AS "__typename"       ) AS "_e"      ) ) AS "jobBoard" FROM  (SELECT  *  FROM "public"."jobboards"  WHERE ((("_root.or.jobBoardsOffer.base"."jobboard_id") = ("id")) AND ((("public"."jobboards"."group_id") IS NULL) OR ((("public"."jobboards"."group_id") = ((($1->>$62))::uuid)) OR ((("public"."jobboards"."group_id") IS NULL) AND (((($1->>$63))::uuid) IS NULL)))))    LIMIT $64 ) AS "_root.or.jobBoardsOffer.or.jobBoard.base"      ) AS "_root.or.jobBoardsOffer.or.jobBoard" ON ($65)      ) AS "_root.or.jobBoardsOffer" ON ($66) LEFT OUTER JOIN LATERAL (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.or.recording.base"."id" AS "id", "_root.or.recording.base"."summary" AS "summary", "_root.or.recording.base"."duration_seconds" AS "durationSeconds", "_root.or.recording.base"."error_code" AS "errorCode", "_root.or.recording.base"."error_message" AS "errorMessage", $67 AS "__typename"       ) AS "_e"      ) ) AS "recording" FROM  (SELECT  *  FROM "public"."recordings"  WHERE ((("_root.base"."recording_id") = ("id")) AND ((("public"."recordings"."deleted_at") IS NULL) AND ((("public"."recordings"."user_id") = ((($1->>$68))::uuid)) OR (("public"."recordings"."group_id") = ((($1->>$69))::uuid)))))    LIMIT $70 ) AS "_root.or.recording.base"      ) AS "_root.or.recording" ON ($71) LEFT OUTER JOIN LATERAL (SELECT  (SELECT  coalesce(json_agg("_sub_query"."files" ORDER BY "ob_col_1" ASC NULLS LAST), $72 )  FROM  (SELECT  "_unnest_table"."files" AS "files", "_unnest_table"."ob_col_1" AS "ob_col_1" FROM UNNEST(array_agg("files" ), array_agg("root.ar.root.files.pg.created_at" )) AS "_unnest_table"("files", "ob_col_1")    ORDER BY "ob_col_1" ASC NULLS LAST LIMIT $73 ) AS "_sub_query"      ) AS "files" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.ar.root.files.base"."file_id" AS "f
1 min 0.2% 197 ms 454 postgres
WITH
all_matched_count AS (
  SELECT count(*) as cnt
  FROM profiles p
  
  
  WHERE p.deleted_at IS NULL
  AND p.group_id = $1::uuid
  AND (EXISTS (SELECT $2 FROM profiles_statuses_cache _rel_profiles_statuses_cache_0 WHERE ((_rel_profiles_statuses_cache_0.profile_id) = (p.id)) AND (((((_rel_profiles_statuses_cache_0.status_id) = ($3)) OR ((_rel_profiles_statuses_cache_0.parent_status_id) = ($4))) AND ((_rel_profiles_statuses_cache_0.group_id) = ($5))) AND ((_rel_profiles_statuses_cache_0.is_talent) = ($6)))))
  AND EXISTS (SELECT $7 FROM profiles_statuses_cache psc WHERE psc.profile_id = p.id AND psc.group_id = $8::uuid AND psc.is_talent = $9)
  
),
all_matched AS (
  SELECT p.id as id
  FROM profiles p
  
  
  
  WHERE p.deleted_at IS NULL
  AND p.group_id = $10::uuid
  AND (EXISTS (SELECT $11 FROM profiles_statuses_cache _rel_profiles_statuses_cache_0 WHERE ((_rel_profiles_statuses_cache_0.profile_id) = (p.id)) AND (((((_rel_profiles_statuses_cache_0.status_id) = ($12)) OR ((_rel_profiles_statuses_cache_0.parent_status_id) = ($13))) AND ((_rel_profiles_statuses_cache_0.group_id) = ($14))) AND ((_rel_profiles_statuses_cache_0.is_talent) = ($15)))))
  AND EXISTS (SELECT $16 FROM profiles_statuses_cache psc WHERE psc.profile_id = p.id AND psc.group_id = $17::uuid AND psc.is_talent = $18)
  
  ORDER BY p.trigger_last_interaction_date DESC NULLS LAST, p.id ASC
  LIMIT $19 OFFSET $20
)
SELECT json_build_object(
  $21, (SELECT COALESCE(json_agg(id), $22::json) FROM all_matched),
  $23, (SELECT cnt FROM all_matched_count),
  $24, $25::json
)::text as result
1 min 0.2% 69 ms 1,249 postgres
SELECT DISTINCT sub.record_id, $1 as rank
FROM (
  SELECT id as record_id
  FROM profiles
  WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($2), paradedb.parse($3), paradedb.parse($4), paradedb.term($5, $6)])
    
    AND deleted_at IS NULL
    
    
    
  LIMIT $7
) sub
1 min 0.2% 52 ms 1,597 nhost_hasura
WITH "_mra__historyentries" AS (INSERT INTO "public"."historyentries" ( "user_id", "deleted_at", "type", "external_id", "created_at", "subject", "message", "profile_id", "group_id", "external_thread_id" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::text, ($4)::text, ($5)::timestamptz, ($6)::text, ($7)::text, ($8)::uuid, ($9)::uuid, ($10)::text) ON CONFLICT ON CONSTRAINT "historyentries_external_id_user_id_profile_id_key" DO UPDATE SET "deleted_at" = EXCLUDED."deleted_at","type" = EXCLUDED."type","external_id" = EXCLUDED."external_id","created_at" = EXCLUDED."created_at","subject" = EXCLUDED."subject","message" = EXCLUDED."message","profile_id" = EXCLUDED."profile_id","external_thread_id" = EXCLUDED."external_thread_id" WHERE (((((("public"."historyentries"."group_id") = (($11)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($12)::uuid) IS NULL))) AND ($13)) AND ($14)) AND ($15)) RETURNING * , CASE WHEN ("public"."historyentries"."xmax") = ($16) THEN ((((((("public"."historyentries"."group_id") = (($17)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($18)::uuid) IS NULL))) AND ($19)) AND ($20)) AND (((EXISTS  (SELECT  $21  FROM "public"."profiles" AS "_be_0_profiles" WHERE (((("_be_0_profiles"."id") = ("public"."historyentries"."profile_id")) AND ($22)) AND (($23) AND ((((("_be_0_profiles"."group_id") = (($24)::uuid)) OR ((("_be_0_profiles"."group_id") IS NULL) AND ((($25)::uuid) IS NULL))) AND ($26)) AND ($27))))     )) AND ($28)) AND ($29))) AND ($30))::boolean ELSE ((((("public"."historyentries"."group_id") = (($31)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($32)::uuid) IS NULL))) AND ($33)) AND ($34))::boolean END AS "check__constraint"), "_aca__historyentries" AS (SELECT  "id" , "created_at" , "updated_at" , "deleted_at" , "profile_id" , "user_id" , "type" , "data" , "message" , "metadata" , "subject" , "external_id" , "external_thread_id" , "event_start_at" , "event_end_at" , "emailAddress" , "sender_user_id" , "linkedin_seat_id" , "is_manually_created" , "project_id" , "message_scheduled_id" , "jobboard_offer_id" , "group_id" , "trigger_occurred_at" , "source" , "should_notify_jobboard_on_change" , "sub_type_id" , "tags" , "phone_number" , "is_merged_from_id" , "recording_id" , "draft_created_at" , "oauth_account_id"  FROM "_mra__historyentries"      ) SELECT  json_build_object($35, (SELECT  COUNT(*)  FROM "_aca__historyentries"      ), $36, (SELECT  coalesce(json_agg("root" ), $37 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", $38 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_aca__historyentries" WHERE ($39)     ) AS "_root.base"      ) AS "_root"      ), $40, $41 ) , (SELECT  coalesce(bool_and("check__constraint" ), $42 )  FROM "_mra__historyentries"      )
1 min 0.2% 33 ms 2,536 nhost_hasura
WITH "_mra__historyentries" AS (INSERT INTO "public"."historyentries" ( "user_id", "deleted_at", "type", "external_id", "created_at", "profile_id", "group_id" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::text, ($4)::text, ($5)::timestamptz, $6, ($7)::uuid) ON CONFLICT ON CONSTRAINT "historyentries_external_id_user_id_profile_id_key" DO UPDATE SET "deleted_at" = EXCLUDED."deleted_at","type" = EXCLUDED."type" WHERE (((((("public"."historyentries"."group_id") = (($8)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($9)::uuid) IS NULL))) AND ($10)) AND ($11)) AND ($12)) RETURNING * , CASE WHEN ("public"."historyentries"."xmax") = ($13) THEN ((((((("public"."historyentries"."group_id") = (($14)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($15)::uuid) IS NULL))) AND ($16)) AND ($17)) AND (((EXISTS  (SELECT  $18  FROM "public"."profiles" AS "_be_0_profiles" WHERE (((("_be_0_profiles"."id") = ("public"."historyentries"."profile_id")) AND ($19)) AND (($20) AND ((((("_be_0_profiles"."group_id") = (($21)::uuid)) OR ((("_be_0_profiles"."group_id") IS NULL) AND ((($22)::uuid) IS NULL))) AND ($23)) AND ($24))))     )) AND ($25)) AND ($26))) AND ($27))::boolean ELSE ((((("public"."historyentries"."group_id") = (($28)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($29)::uuid) IS NULL))) AND ($30)) AND ($31))::boolean END AS "check__constraint"), "_aca__historyentries" AS (SELECT  "id" , "created_at" , "updated_at" , "deleted_at" , "profile_id" , "user_id" , "type" , "data" , "message" , "metadata" , "subject" , "external_id" , "external_thread_id" , "event_start_at" , "event_end_at" , "emailAddress" , "sender_user_id" , "linkedin_seat_id" , "is_manually_created" , "project_id" , "message_scheduled_id" , "jobboard_offer_id" , "group_id" , "trigger_occurred_at" , "source" , "should_notify_jobboard_on_change" , "sub_type_id" , "tags" , "phone_number" , "is_merged_from_id" , "recording_id" , "draft_created_at" , "oauth_account_id"  FROM "_mra__historyentries"      ) SELECT  json_build_object($32, (SELECT  COUNT(*)  FROM "_aca__historyentries"      ) ) , (SELECT  coalesce(bool_and("check__constraint" ), $33 )  FROM "_mra__historyentries"      )
1 min 0.2% 48 ms 1,703 nhost_hasura
WITH "_mra__historyentries" AS (INSERT INTO "public"."historyentries" ( "user_id", "deleted_at", "type", "oauth_account_id", "project_id", "external_id", "created_at", "subject", "emailAddress", "message_scheduled_id", "message", "profile_id", "group_id", "external_thread_id", "data" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::text, ($4)::text, ($5)::uuid, ($6)::text, ($7)::timestamptz, ($8)::text, ($9)::text, ($10)::uuid, ($11)::text, ($12)::uuid, ($13)::uuid, ($14)::text, ($15)::jsonb) ON CONFLICT ON CONSTRAINT "historyentries_external_id_user_id_profile_id_key" DO UPDATE SET "type" = EXCLUDED."type","oauth_account_id" = EXCLUDED."oauth_account_id","project_id" = EXCLUDED."project_id","external_id" = EXCLUDED."external_id","created_at" = EXCLUDED."created_at","subject" = EXCLUDED."subject","emailAddress" = EXCLUDED."emailAddress","message_scheduled_id" = EXCLUDED."message_scheduled_id","message" = EXCLUDED."message","profile_id" = EXCLUDED."profile_id","external_thread_id" = EXCLUDED."external_thread_id","data" = EXCLUDED."data" WHERE (((((("public"."historyentries"."group_id") = (($16)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($17)::uuid) IS NULL))) AND ($18)) AND ($19)) AND ($20)) RETURNING * , CASE WHEN ("public"."historyentries"."xmax") = ($21) THEN ((((((("public"."historyentries"."group_id") = (($22)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($23)::uuid) IS NULL))) AND ($24)) AND ($25)) AND (((EXISTS  (SELECT  $26  FROM "public"."profiles" AS "_be_0_profiles" WHERE (((("_be_0_profiles"."id") = ("public"."historyentries"."profile_id")) AND ($27)) AND (($28) AND ((((("_be_0_profiles"."group_id") = (($29)::uuid)) OR ((("_be_0_profiles"."group_id") IS NULL) AND ((($30)::uuid) IS NULL))) AND ($31)) AND ($32))))     )) AND ($33)) AND ($34))) AND ($35))::boolean ELSE ((((("public"."historyentries"."group_id") = (($36)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($37)::uuid) IS NULL))) AND ($38)) AND ($39))::boolean END AS "check__constraint"), "_aca__historyentries" AS (SELECT  "id" , "created_at" , "updated_at" , "deleted_at" , "profile_id" , "user_id" , "type" , "data" , "message" , "metadata" , "subject" , "external_id" , "external_thread_id" , "event_start_at" , "event_end_at" , "emailAddress" , "sender_user_id" , "linkedin_seat_id" , "is_manually_created" , "project_id" , "message_scheduled_id" , "jobboard_offer_id" , "group_id" , "trigger_occurred_at" , "source" , "should_notify_jobboard_on_change" , "sub_type_id" , "tags" , "phone_number" , "is_merged_from_id" , "recording_id" , "draft_created_at" , "oauth_account_id"  FROM "_mra__historyentries"      ) SELECT  json_build_object($40, (SELECT  COUNT(*)  FROM "_aca__historyentries"      ), $41, (SELECT  coalesce(json_agg("root" ), $42 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", $43 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_aca__historyentries" WHERE ($44)     ) AS "_root.base"      ) AS "_root"      ), $45, $46 ) , (SELECT  coalesce(bool_and("check__constraint" ), $47 )  FROM "_mra__historyentries"      )
1 min 0.2% 57 ms 1,398 postgres
SELECT DISTINCT sub.record_id, $1 as rank
FROM (
  SELECT profile_id as record_id
  FROM profiles_fieldsvalues
  WHERE id @@@ paradedb.boolean(must => ARRAY[paradedb.parse($2), paradedb.term($3, $4)])
    
    AND deleted_at IS NULL
    AND profile_id IS NOT NULL
    
    
  LIMIT $5
) sub
1 min 0.2% 58 ms 1,365 nhost_hasura
WITH "_mra__historyentries" AS (INSERT INTO "public"."historyentries" ( "user_id", "deleted_at", "type", "external_id", "created_at", "subject", "message", "profile_id", "group_id", "external_thread_id" ) VALUES (($1)::uuid, ($2)::timestamptz, ($3)::text, ($4)::text, ($5)::timestamptz, ($6)::text, ($7)::text, ($8)::uuid, ($9)::uuid, ($10)::text), (($11)::uuid, ($12)::timestamptz, ($13)::text, ($14)::text, ($15)::timestamptz, ($16)::text, ($17)::text, ($18)::uuid, ($19)::uuid, ($20)::text) ON CONFLICT ON CONSTRAINT "historyentries_external_id_user_id_profile_id_key" DO UPDATE SET "deleted_at" = EXCLUDED."deleted_at","type" = EXCLUDED."type","external_id" = EXCLUDED."external_id","created_at" = EXCLUDED."created_at","subject" = EXCLUDED."subject","message" = EXCLUDED."message","profile_id" = EXCLUDED."profile_id","external_thread_id" = EXCLUDED."external_thread_id" WHERE (((((("public"."historyentries"."group_id") = (($21)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($22)::uuid) IS NULL))) AND ($23)) AND ($24)) AND ($25)) RETURNING * , CASE WHEN ("public"."historyentries"."xmax") = ($26) THEN ((((((("public"."historyentries"."group_id") = (($27)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($28)::uuid) IS NULL))) AND ($29)) AND ($30)) AND (((EXISTS  (SELECT  $31  FROM "public"."profiles" AS "_be_0_profiles" WHERE (((("_be_0_profiles"."id") = ("public"."historyentries"."profile_id")) AND ($32)) AND (($33) AND ((((("_be_0_profiles"."group_id") = (($34)::uuid)) OR ((("_be_0_profiles"."group_id") IS NULL) AND ((($35)::uuid) IS NULL))) AND ($36)) AND ($37))))     )) AND ($38)) AND ($39))) AND ($40))::boolean ELSE ((((("public"."historyentries"."group_id") = (($41)::uuid)) OR ((("public"."historyentries"."group_id") IS NULL) AND ((($42)::uuid) IS NULL))) AND ($43)) AND ($44))::boolean END AS "check__constraint"), "_aca__historyentries" AS (SELECT  "id" , "created_at" , "updated_at" , "deleted_at" , "profile_id" , "user_id" , "type" , "data" , "message" , "metadata" , "subject" , "external_id" , "external_thread_id" , "event_start_at" , "event_end_at" , "emailAddress" , "sender_user_id" , "linkedin_seat_id" , "is_manually_created" , "project_id" , "message_scheduled_id" , "jobboard_offer_id" , "group_id" , "trigger_occurred_at" , "source" , "should_notify_jobboard_on_change" , "sub_type_id" , "tags" , "phone_number" , "is_merged_from_id" , "recording_id" , "draft_created_at" , "oauth_account_id"  FROM "_mra__historyentries"      ) SELECT  json_build_object($45, (SELECT  COUNT(*)  FROM "_aca__historyentries"      ), $46, (SELECT  coalesce(json_agg("root" ), $47 ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_e"  FROM  (SELECT  "_root.base"."id" AS "id", $48 AS "__typename"       ) AS "_e"      ) ) AS "root" FROM  (SELECT  *  FROM "_aca__historyentries" WHERE ($49)     ) AS "_root.base"      ) AS "_root"      ), $50, $51 ) , (SELECT  coalesce(bool_and("check__constraint" ), $52 )  FROM "_mra__historyentries"      )