PgHero

Queries

Total Time Average Time Calls
315,323 min 81% 91 ms 208,524,053 flightcontrol
SELECT "good_jobs"."id", "good_jobs"."queue_name", "good_jobs"."priority", "good_jobs"."serialized_params", "good_jobs"."scheduled_at", "good_jobs"."performed_at", "good_jobs"."finished_at", "good_jobs"."error", "good_jobs"."created_at", "good_jobs"."updated_at", "good_jobs"."active_job_id", "good_jobs"."concurrency_key", "good_jobs"."cron_key", "good_jobs"."cron_at", "good_jobs"."batch_id", "good_jobs"."batch_callback_id", "good_jobs"."executions_count", "good_jobs"."job_class", "good_jobs"."error_event", "good_jobs"."labels", "good_jobs"."locked_by_id", "good_jobs"."locked_at" FROM "good_jobs" WHERE "good_jobs"."id" IN (WITH "rows" AS  MATERIALIZED (SELECT "good_jobs"."id" FROM "good_jobs" WHERE "good_jobs"."finished_at" IS NULL AND "good_jobs"."scheduled_at" <= $1 ORDER BY priority ASC NULLS LAST, "good_jobs"."created_at" ASC) SELECT "rows"."id" FROM "rows" WHERE pg_try_advisory_lock(($3 || substr(md5($4 || $5 || "rows"."id"::text), $6, $7))::bit(64)::bigint) LIMIT $2) ORDER BY priority ASC NULLS LAST, "good_jobs"."created_at" ASC
61,920 min 16% 74 ms 49,938,362 flightcontrol
SELECT pg_advisory_xact_lock(($2||substr(md5($1::text), $3, $4))::bit(64)::bigint)::text AS locked
3,158 min 0.8% 75 ms 2,541,261 flightcontrol
SELECT "good_job_executions"."active_job_id" FROM "good_job_executions" INNER JOIN "good_jobs" ON "good_jobs"."id" = "good_job_executions"."active_job_id" WHERE "good_jobs"."concurrency_key" = $1 AND "good_job_executions"."created_at" > $2 AND ("good_job_executions"."error" IS NULL OR "good_job_executions"."error" != $3) ORDER BY "good_job_executions"."created_at" ASC LIMIT $4
978 min 0.3% 3 ms 20,256,781 flightcontrol
INSERT INTO "sessions" ("session_id", "data", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"
685 min 0.2% 536 ms 76,610 flightcontrol
SELECT "good_jobs"."active_job_id" FROM "good_jobs" WHERE "good_jobs"."finished_at" <= $1 ORDER BY "good_jobs"."finished_at" ASC LIMIT $2
Details
CREATE INDEX CONCURRENTLY ON good_jobs (finished_at)
Rows: 533022
Row progression: 533022, 38266

Row estimates
- finished_at (<=): 38266
- finished_at (sort): 1

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
571 min 0.1% 7 ms 5,258,067 flightcontrol
UPDATE "conversations" SET "updated_at" = $1, "transcript" = $2 WHERE "conversations"."id" = $3
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
558 min 0.1% 3,134 ms 10,688 flightcontrol
SELECT AVG("conversations"."qa_score_effective") FROM "conversations" WHERE "conversations"."organization_id" = $1 AND "conversations"."started_at" BETWEEN $2 AND $3
Covered by index on (started_at)
Rows: 1522347
Row progression: 1522347, 152093

Row estimates
- started_at (BETWEEN): 152093
- organization_id (=): 169150

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
418 min 0.1% 2 ms 11,111,052 flightcontrol
SELECT "good_jobs"."active_job_id" FROM "good_jobs" LEFT JOIN pg_locks ON pg_locks.locktype = $3 AND pg_locks.objsubid = $4 AND pg_locks.classid = ($5 || substr(md5($6 || $7 || "good_jobs"."id"::text), $8, $9))::bit(32)::int AND pg_locks.objid = (($10 || substr(md5($11 || $12 || "good_jobs"."id"::text), $13, $14))::bit(64) << $15)::bit(32)::int WHERE "good_jobs"."finished_at" IS NULL AND "good_jobs"."concurrency_key" = $1 AND "pg_locks"."locktype" IS NOT NULL ORDER BY COALESCE(performed_at, scheduled_at, created_at) ASC LIMIT $2
413 min 0.1% 1 ms 31,539,059 flightcontrol
INSERT INTO "good_job_executions" ("created_at", "updated_at", "active_job_id", "job_class", "queue_name", "serialized_params", "scheduled_at", "finished_at", "error", "error_event", "error_backtrace", "process_id", "duration") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13) RETURNING "id"
367 min < 0.1% 1 ms 28,623,180 flightcontrol
INSERT INTO "good_jobs" ("id", "queue_name", "priority", "serialized_params", "scheduled_at", "performed_at", "finished_at", "error", "created_at", "updated_at", "active_job_id", "concurrency_key", "cron_key", "cron_at", "batch_id", "batch_callback_id", "executions_count", "job_class", "error_event", "labels", "locked_by_id", "locked_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22) RETURNING "id"
348 min < 0.1% 1 ms 15,747,638 flightcontrol
SELECT $4 AS one FROM "conversation_parts" WHERE "conversation_parts"."organization_id" = $1 AND "conversation_parts"."public_id" = $2 LIMIT $3
Covered by index on (public_id)
Rows: 26678064
Row progression: 26678064, 1

Row estimates
- public_id (=): 1
- organization_id (=): 5335613

Existing indexes
- id PRIMARY
- author_client_id
- author_employee_id
- author_employee_id, author_type
- conversation_id
- conversation_id, author_type
- data_source_id
- external_created_at
- organization_data_source_id
- organization_data_source_id, external_id WHERE (organization_data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id
- organization_id, data_source_id, conversation_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- public_id UNIQUE
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- type
225 min < 0.1% 1 ms 15,743,141 flightcontrol
INSERT INTO "conversation_parts" ("organization_id", "public_id", "conversation_id", "author_type", "type", "created_at", "updated_at", "reference_id", "external_created_at", "data_source_id", "external_id", "author_client_id", "author_employee_id", "author_name", "image_attached", "image_caption", "body", "html_body", "body_english", "organization_data_source_id", "redacted_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21) RETURNING "id"
204 min < 0.1% 6 ms 2,179,320 flightcontrol
SELECT $5 AS one FROM "jira_issues" WHERE "jira_issues"."issue_key" = $1 AND "jira_issues"."id" != $2 AND "jira_issues"."organization_data_source_id" = $3 LIMIT $4
Details
CREATE INDEX CONCURRENTLY ON jira_issues (issue_key)
Rows: 34244
Row progression: 34244, 1

Row estimates
- issue_key (=): 1
- organization_data_source_id (=): 5707
- id (<>): 34243

Existing indexes
- id PRIMARY
- created_by_id
- jira_issue_draft_id
- jira_request_type_id
- organization_data_source_id
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
183 min < 0.1% 1 ms 8,307,739 flightcontrol
SELECT $4 AS one FROM "conversation_part_chat_details" WHERE "conversation_part_chat_details"."organization_id" = $1 AND "conversation_part_chat_details"."public_id" = $2 LIMIT $3
Details
CREATE INDEX CONCURRENTLY ON conversation_part_chat_details (public_id)
Rows: 15255956
Row progression: 15255956, 1

Row estimates
- public_id (=): 1
- organization_id (=): 3051191

Existing indexes
- id PRIMARY
- conversation_part_id
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
176 min < 0.1% 0 ms 31,538,476 flightcontrol
UPDATE "good_jobs" SET "performed_at" = $1, "updated_at" = $2, "executions_count" = $3, "locked_by_id" = $4, "locked_at" = $5 WHERE "good_jobs"."id" = $6
Covered by index on (id)
Rows: 533022
Row progression: 533022, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
164 min < 0.1% 1,015 ms 9,698 flightcontrol
SELECT AVG("conversation_customer_sentiment_summaries"."score") FROM "conversations" INNER JOIN "conversation_customer_sentiment_summaries" ON "conversation_customer_sentiment_summaries"."organization_id" = $1 AND "conversation_customer_sentiment_summaries"."conversation_id" = "conversations"."id" WHERE "conversations"."organization_id" = $2 AND NOT (("conversation_customer_sentiment_summaries"."score" = $3 OR "conversation_customer_sentiment_summaries"."score" IS NULL)) AND "conversations"."started_at" BETWEEN $4 AND $5
162 min < 0.1% 0 ms 88,642,657 flightcontrol
SELECT "conversation_part_chat_details".* FROM "conversation_part_chat_details" WHERE "conversation_part_chat_details"."organization_id" = $1 AND "conversation_part_chat_details"."conversation_part_id" = $2 LIMIT $3
Covered by index on (conversation_part_id)
Rows: 15255956
Row progression: 15255956, 1

Row estimates
- conversation_part_id (=): 1
- organization_id (=): 3051191

Existing indexes
- id PRIMARY
- conversation_part_id
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
161 min < 0.1% 1 ms 18,479,392 flightcontrol
SELECT COUNT(*) FROM "good_jobs" LEFT JOIN pg_locks ON pg_locks.locktype = $2 AND pg_locks.objsubid = $3 AND pg_locks.classid = ($4 || substr(md5($5 || $6 || "good_jobs"."id"::text), $7, $8))::bit(32)::int AND pg_locks.objid = (($9 || substr(md5($10 || $11 || "good_jobs"."id"::text), $12, $13))::bit(64) << $14)::bit(32)::int WHERE "good_jobs"."concurrency_key" = $1 AND "good_jobs"."finished_at" IS NULL AND "pg_locks"."locktype" IS NULL
157 min < 0.1% 0 ms 208,586,111 flightcontrol
SELECT $6 AS one FROM "conversation_parts" WHERE "conversation_parts"."organization_id" = $1 AND "conversation_parts"."conversation_id" = $2 AND "conversation_parts"."data_source_id" = $3 AND "conversation_parts"."external_id" = $4 LIMIT $5
Details
CREATE INDEX CONCURRENTLY ON conversation_parts (external_id)
Rows: 26678064
Row progression: 26678064, 1

Row estimates
- external_id (=): 1
- conversation_id (=): 98
- data_source_id (=): 4443380
- organization_id (=): 5335613

Existing indexes
- id PRIMARY
- author_client_id
- author_employee_id
- author_employee_id, author_type
- conversation_id
- conversation_id, author_type
- data_source_id
- external_created_at
- organization_data_source_id
- organization_data_source_id, external_id WHERE (organization_data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id
- organization_id, data_source_id, conversation_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- public_id UNIQUE
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- type
150 min < 0.1% 4 ms 2,047,760 flightcontrol
UPDATE "conversations" SET "updated_at" = $1, "custom_attributes" = $2 WHERE "conversations"."id" = $3
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
141 min < 0.1% 14 ms 614,533 flightcontrol
UPDATE "conversations" SET "updated_at" = $1, "closed_at" = $2 WHERE "conversations"."id" = $3
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
136 min < 0.1% 4 ms 1,816,291 flightcontrol
UPDATE "conversation_threads" SET "initial_contact_at" = $1, "last_contact_at" = $2, "contacts_count" = $3 WHERE "conversation_threads"."id" = $4
Covered by index on (id)
Rows: 1482225
Row progression: 1482225, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
- root_conversation_id UNIQUE
132 min < 0.1% 0 ms 28,539,731 flightcontrol
UPDATE "good_job_executions" SET "updated_at" = $1, "finished_at" = $2, "duration" = $3 WHERE "good_job_executions"."id" = $4
Covered by index on (id)
Rows: 866095
Row progression: 866095, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_job_id, created_at
- process_id, created_at
130 min < 0.1% 24 ms 326,178 flightcontrol
UPDATE "conversations" SET "updated_at" = $1, "evaluation_state" = $2 WHERE "conversations"."id" = $3
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
118 min < 0.1% 8 ms 876,120 flightcontrol
UPDATE "conversations" SET "updated_at" = $1, "conversation_thread_id" = $2 WHERE "conversations"."id" = $3
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
117 min < 0.1% 8 ms 915,403 flightcontrol
UPDATE "conversations" SET "updated_at" = $1, "translation_state" = $2 WHERE "conversations"."id" = $3
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
116 min < 0.1% 73 ms 95,365 flightcontrol
SELECT COUNT(*) FROM "good_jobs" WHERE "good_jobs"."concurrency_key" = $1 AND "good_jobs"."created_at" > $2
Covered by index on (concurrency_key, created_at)
Rows: 533022
Row progression: 533022, 62, 6

Row estimates
- concurrency_key (=): 62
- created_at (>): 53302

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
116 min < 0.1% 2 ms 3,508,580 flightcontrol
INSERT INTO "active_storage_blobs" ("key", "filename", "content_type", "metadata", "service_name", "byte_size", "checksum", "created_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id"
114 min < 0.1% 6 ms 1,205,874 flightcontrol
UPDATE "conversations" SET "updated_at" = $1, "ticket_status" = $2 WHERE "conversations"."id" = $3
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
110 min < 0.1% 0 ms 47,555,903 flightcontrol
SELECT "good_jobs"."id", "good_jobs"."queue_name", "good_jobs"."priority", "good_jobs"."serialized_params", "good_jobs"."scheduled_at", "good_jobs"."performed_at", "good_jobs"."finished_at", "good_jobs"."error", "good_jobs"."created_at", "good_jobs"."updated_at", "good_jobs"."active_job_id", "good_jobs"."concurrency_key", "good_jobs"."cron_key", "good_jobs"."cron_at", "good_jobs"."batch_id", "good_jobs"."batch_callback_id", "good_jobs"."executions_count", "good_jobs"."job_class", "good_jobs"."error_event", "good_jobs"."labels", "good_jobs"."locked_by_id", "good_jobs"."locked_at" FROM "good_jobs" WHERE "good_jobs"."id" = $1 LIMIT $2
Covered by index on (id)
Rows: 533022
Row progression: 533022, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
108 min < 0.1% 114 ms 57,072 flightcontrol
DELETE FROM "good_job_batches" WHERE ("good_job_batches"."id") IN (SELECT "good_job_batches"."id" FROM "good_job_batches" WHERE "good_job_batches"."finished_at" <= $1 LIMIT $2)
105 min < 0.1% 6 ms 1,021,608 flightcontrol
SELECT "jira_issues".* FROM "jira_issues" WHERE "jira_issues"."organization_id" = $1 AND "jira_issues"."organization_data_source_id" = $2 AND "jira_issues"."issue_key" = $3 LIMIT $4
Details
CREATE INDEX CONCURRENTLY ON jira_issues (issue_key)
Rows: 34244
Row progression: 34244, 1

Row estimates
- issue_key (=): 1
- organization_data_source_id (=): 5707
- organization_id (=): 5707

Existing indexes
- id PRIMARY
- created_by_id
- jira_issue_draft_id
- jira_request_type_id
- organization_data_source_id
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
93 min < 0.1% 10 ms 575,995 flightcontrol
UPDATE "conversations" SET "updated_at" = $1, "transcription_state" = $2 WHERE "conversations"."id" = $3
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
92 min < 0.1% 4,855 ms 1,136 flightcontrol
SELECT COUNT(*) AS "count_all", ("good_jobs"."serialized_params" ->> $1) AS "good_jobs_serialized_params_job_class" FROM "good_jobs" GROUP BY ("good_jobs"."serialized_params" ->> 'job_class')
89 min < 0.1% 9 ms 588,377 flightcontrol
UPDATE "conversations" SET "updated_at" = $1, "closed_at" = $2, "handling_time" = $3 WHERE "conversations"."id" = $4
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
87 min < 0.1% 0 ms 27,388,064 flightcontrol
UPDATE "good_jobs" SET "locked_by_id" = $1, "locked_at" = $2, "finished_at" = $3, "updated_at" = $4 WHERE "good_jobs"."id" = $5
Covered by index on (id)
Rows: 533022
Row progression: 533022, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
79 min < 0.1% 3 ms 1,403,889 flightcontrol
SELECT COUNT(*) FROM "evaluation_usages" WHERE "evaluation_usages"."organization_id" = $1 AND "evaluation_usages"."evaluation_credit_id" = $2
Details
CREATE INDEX CONCURRENTLY ON evaluation_usages (evaluation_credit_id, organization_id)
Rows: 88204
Row progression: 88204, 8820, 980

Row estimates
- evaluation_credit_id (=): 8820
- organization_id (=): 9800

Existing indexes
- id PRIMARY
- conversation_id UNIQUE
- evaluation_credit_id
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
77 min < 0.1% 10 ms 480,973 flightcontrol
UPDATE "conversation_parts" SET "redacted_at" = $1 WHERE "conversation_parts"."id" = $2
Covered by index on (id)
Rows: 26678064
Row progression: 26678064, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- author_client_id
- author_employee_id
- author_employee_id, author_type
- conversation_id
- conversation_id, author_type
- data_source_id
- external_created_at
- organization_data_source_id
- organization_data_source_id, external_id WHERE (organization_data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id
- organization_id, data_source_id, conversation_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- public_id UNIQUE
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- type
73 min < 0.1% 22 ms 195,583 flightcontrol
UPDATE "conversations" SET "evaluation_state" = $1, "updated_at" = $2 WHERE "conversations"."id" = $3
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
58 min < 0.1% 493 ms 7,064 flightcontrol
SELECT COUNT(*) FROM "conversations" INNER JOIN "conversation_cx_risk_snapshots" "active_evaluation" ON "active_evaluation"."organization_id" = $1 AND "active_evaluation"."id" = "conversations"."active_evaluation_id" WHERE "conversations"."organization_id" = $2 AND "active_evaluation"."id" IS NOT NULL AND "conversations"."started_at" BETWEEN $3 AND $4
57 min < 0.1% 0 ms 20,330,395 flightcontrol
UPDATE "sessions" SET "data" = $1, "updated_at" = $2 WHERE "sessions"."id" = $3
Covered by index on (id)
Rows: 5927464
Row progression: 5927464, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- session_id UNIQUE
- updated_at
55 min < 0.1% 0 ms 46,638,223 flightcontrol
SELECT "conversation_field_values".* FROM "conversation_field_values" WHERE "conversation_field_values"."organization_id" = $1 AND "conversation_field_values"."conversation_id" = $2 AND "conversation_field_values"."conversation_field_id" = $3 LIMIT $4
Covered by index on (conversation_id, conversation_field_id)
Rows: 3463383
Row progression: 3463383, 52, 0

Row estimates
- conversation_id (=): 52
- conversation_field_id (=): 21379
- organization_id (=): 1154461

Existing indexes
- id PRIMARY
- conversation_field_id
- conversation_id
- conversation_id, conversation_field_id UNIQUE
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
54 min < 0.1% 0 ms 8,307,738 flightcontrol
INSERT INTO "conversation_part_chat_details" ("organization_id", "conversation_part_id", "content", "public_id", "created_at", "updated_at", "sent_at", "uses_redacted_tag", "html_content") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id"
52 min < 0.1% 26 ms 120,560 flightcontrol
SELECT EXTRACT($1 FROM NOW() - MIN(created_at)) AS latency_seconds FROM good_jobs WHERE finished_at IS NULL AND scheduled_at <= NOW()
Details
CREATE INDEX CONCURRENTLY ON good_jobs (scheduled_at)
Rows: 533022
Row progression: 533022, 53302

Row estimates
- scheduled_at (<=): 53302
- finished_at (null): 150366

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
49 min < 0.1% 12 ms 235,140 flightcontrol
SELECT $4 AS one FROM "conversation_cx_risk_snapshots" WHERE "conversation_cx_risk_snapshots"."processing_status" = $1 AND "conversation_cx_risk_snapshots"."conversation_id" = $2 LIMIT $3
Covered by index on (conversation_id)
Rows: 302361
Row progression: 302361, 5

Row estimates
- conversation_id (=): 5
- processing_status (=): 100787

Existing indexes
- id PRIMARY
- agent_knowledge_gap_id
- conversation_id
- conversation_id, active WHERE active = true UNIQUE
- customer_complaint_id
- customer_issue_id
- customer_issue_summary_embedding halfvec_cosine_ops HNSW
- organization_id
- organization_id, id
- processing_status
49 min < 0.1% 1,287 ms 2,276 flightcontrol
SELECT COUNT(*) FROM "good_jobs" WHERE "good_jobs"."performed_at" IS NULL AND "good_jobs"."finished_at" IS NULL AND "good_jobs"."scheduled_at" <= $1
Details
CREATE INDEX CONCURRENTLY ON good_jobs (scheduled_at)
Rows: 533022
Row progression: 533022, 53302

Row estimates
- scheduled_at (<=): 53302
- performed_at (null): 150348
- finished_at (null): 150366

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
48 min < 0.1% 0 ms 19,301,508 flightcontrol
SELECT "pg_search_documents".* FROM "pg_search_documents" WHERE "pg_search_documents"."searchable_id" = $1 AND "pg_search_documents"."searchable_type" = $2 LIMIT $3
46 min < 0.1% 2,432 ms 1,136 flightcontrol
SELECT COUNT(*) AS "count_all", "good_jobs"."queue_name" AS "good_jobs_queue_name" FROM "good_jobs" GROUP BY "good_jobs"."queue_name"
44 min < 0.1% 2 ms 1,548,072 flightcontrol
UPDATE "conversations" SET "first_agent_response_at" = $1 WHERE "conversations"."id" = $2
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
41 min < 0.1% 0 ms 8,742,521 flightcontrol
SELECT "conversation_part_notes".* FROM "conversation_part_notes" WHERE "conversation_part_notes"."organization_id" = $1 AND "conversation_part_notes"."conversation_part_id" = $2 LIMIT $3
Covered by index on (conversation_part_id)
Rows: 1716854
Row progression: 1716854, 1

Row estimates
- conversation_part_id (=): 1
- organization_id (=): 286142

Existing indexes
- id PRIMARY
- conversation_part_id UNIQUE
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
40 min < 0.1% 1,622 ms 1,492 flightcontrol
SELECT AVG("conversations"."qa_score_effective") FROM "conversations" INNER JOIN "conversation_agents" ON "conversation_agents"."organization_id" = $1 AND "conversation_agents"."conversation_id" = "conversations"."id" WHERE "conversations"."organization_id" = $2 AND "conversations"."started_at" BETWEEN $3 AND $4 AND "conversation_agents"."employee_id" = $5
38 min < 0.1% 4 ms 513,194 flightcontrol
UPDATE "conversations" SET "first_customer_message_at" = $1 WHERE "conversations"."id" = $2
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
37 min < 0.1% 0 ms 15,248,559 flightcontrol
SELECT "conversation_part_attribute_updated_by_admins".* FROM "conversation_part_attribute_updated_by_admins" WHERE "conversation_part_attribute_updated_by_admins"."organization_id" = $1 AND "conversation_part_attribute_updated_by_admins"."conversation_part_id" = $2 LIMIT $3
Covered by index on (conversation_part_id)
Rows: 5667550
Row progression: 5667550, 1

Row estimates
- conversation_part_id (=): 1
- organization_id (=): 1416888

Existing indexes
- id PRIMARY
- conversation_part_id
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
37 min < 0.1% 0 ms 7,516,584 flightcontrol
INSERT INTO "good_job_batches" ("created_at", "updated_at", "description", "serialized_properties", "on_finish", "on_success", "on_discard", "callback_queue_name", "callback_priority", "enqueued_at", "discarded_at", "finished_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING "id"
36 min < 0.1% 0 ms 4,933,099 flightcontrol
SELECT "conversation_parts".* FROM "conversation_parts" LEFT OUTER JOIN "employees" ON "employees"."organization_id" = $1 AND "employees"."id" = "conversation_parts"."author_employee_id" WHERE "conversation_parts"."organization_id" = $2 AND "conversation_parts"."conversation_id" = $3 AND (author_employee_id IS NULL OR employees.excluded_from_conversation_parts = $4) ORDER BY "conversation_parts"."external_created_at" ASC, "conversation_parts"."created_at" ASC
33 min < 0.1% 18 ms 108,257 flightcontrol
SELECT "conversation_parts".* FROM "conversation_parts" WHERE "conversation_parts"."organization_id" = $1 AND "conversation_parts"."conversation_id" = $2 AND "conversation_parts"."type" IN ($3, $4, $5, $6) AND "conversation_parts"."redacted_at" IS NULL ORDER BY "conversation_parts"."id" ASC LIMIT $7
Details
CREATE INDEX CONCURRENTLY ON conversation_parts (conversation_id, type)
Rows: 26678064
Row progression: 26678064, 98, 11

Row estimates
- conversation_id (=): 98
- type (=): 2964229
- organization_id (=): 5335613
- redacted_at (null): 25344161
- id (sort): 1

Existing indexes
- id PRIMARY
- author_client_id
- author_employee_id
- author_employee_id, author_type
- conversation_id
- conversation_id, author_type
- data_source_id
- external_created_at
- organization_data_source_id
- organization_data_source_id, external_id WHERE (organization_data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id
- organization_id, data_source_id, conversation_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- public_id UNIQUE
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- type
31 min < 0.1% 869 ms 2,148 flightcontrol
SELECT COUNT(*) FROM "good_jobs" WHERE "good_jobs"."finished_at" IS NOT NULL AND "good_jobs"."error" IS NOT NULL
Details
CREATE INDEX CONCURRENTLY ON good_jobs (error)
Rows: 533022
Row progression: 533022, 9239, 6633

Row estimates
- error (not_null): 9239
- finished_at (not_null): 382656

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
31 min < 0.1% 1 ms 1,491,478 flightcontrol
UPDATE "conversations" SET "first_customer_response_at" = $1 WHERE "conversations"."id" = $2
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
30 min < 0.1% 0 ms 22,930,979 flightcontrol
SELECT "sessions".* FROM "sessions" WHERE "sessions"."session_id" = $1 ORDER BY "sessions"."id" ASC LIMIT $2
Covered by index on (session_id)
Rows: 5927464
Row progression: 5927464, 1

Row estimates
- session_id (=): 1
- id (sort): 1

Existing indexes
- id PRIMARY
- session_id UNIQUE
- updated_at
29 min < 0.1% 914 ms 1,880 flightcontrol
SELECT COUNT(*) FROM "good_jobs" WHERE "good_jobs"."finished_at" IS NULL AND "good_jobs"."scheduled_at" > $1 AND ("good_jobs"."serialized_params" ->> $2) :: integer < $3
28 min < 0.1% 1,512 ms 1,127 flightcontrol
SELECT COUNT(*) FROM "good_jobs" WHERE "good_jobs"."performed_at" IS NOT NULL AND "good_jobs"."finished_at" IS NULL
Details
CREATE INDEX CONCURRENTLY ON good_jobs (finished_at)
Rows: 533022
Row progression: 533022, 150366, 107952

Row estimates
- finished_at (null): 150366
- performed_at (not_null): 382674

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
28 min < 0.1% 1,504 ms 1,114 flightcontrol
DELETE FROM "good_job_executions" WHERE "good_job_executions"."active_job_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $60, $61, $62, $63, $64, $65, $66, $67, $68, $69, $70, $71, $72, $73, $74, $75, $76, $77, $78, $79, $80, $81, $82, $83, $84, $85, $86, $87, $88, $89, $90, $91, $92, $93, $94, $95, $96, $97, $98, $99, $100, $101, $102, $103, $104, $105, $106, $107, $108, $109, $110, $111, $112, $113, $114, $115, $116, $117, $118, $119, $120, $121, $122, $123, $124, $125, $126, $127, $128, $129, $130, $131, $132, $133, $134, $135, $136, $137, $138, $139, $140, $141, $142, $143, $144, $145, $146, $147, $148, $149, $150, $151, $152, $153, $154, $155, $156, $157, $158, $159, $160, $161, $162, $163, $164, $165, $166, $167, $168, $169, $170, $171, $172, $173, $174, $175, $176, $177, $178, $179, $180, $181, $182, $183, $184, $185, $186, $187, $188, $189, $190, $191, $192, $193, $194, $195, $196, $197, $198, $199, $200, $201, $202, $203, $204, $205, $206, $207, $208, $209, $210, $211, $212, $213, $214, $215, $216, $217, $218, $219, $220, $221, $222, $223, $224, $225, $226, $227, $228, $229, $230, $231, $232, $233, $234, $235, $236, $237, $238, $239, $240, $241, $242, $243, $244, $245, $246, $247, $248, $249, $250, $251, $252, $253, $254, $255, $256, $257, $258, $259, $260, $261, $262, $263, $264, $265, $266, $267, $268, $269, $270, $271, $272, $273, $274, $275, $276, $277, $278, $279, $280, $281, $282, $283, $284, $285, $286, $287, $288, $289, $290, $291, $292, $293, $294, $295, $296, $297, $298, $299, $300, $301, $302, $303, $304, $305, $306, $307, $308, $309, $310, $311, $312, $313, $314, $315, $316, $317, $318, $319, $320, $321, $322, $323, $324, $325, $326, $327, $328, $329, $330, $331, $332, $333, $334, $335, $336, $337, $338, $339, $340, $341, $342, $343, $344, $345, $346, $347, $348, $349, $350, $351, $352, $353, $354, $355, $356, $357, $358, $359, $360, $361, $362, $363, $364, $365, $366, $367, $368, $369, $370, $371, $372, $373, $374, $375, $376, $377, $378, $379, $380, $381, $382, $383, $384, $385, $386, $387, $388, $389, $390, $391, $392, $393, $394, $395, $396, $397, $398, $399, $400, $401, $402, $403, $404, $405, $406, $407, $408, $409, $410, $411, $412, $413, $414, $415, $416, $417, $418, $419, $420, $421, $422, $423, $424, $425, $426, $427, $428, $429, $430, $431, $432, $433, $434, $435, $436, $437, $438, $439, $440, $441, $442, $443, $444, $445, $446, $447, $448, $449, $450, $451, $452, $453, $454, $455, $456, $457, $458, $459, $460, $461, $462, $463, $464, $465, $466, $467, $468, $469, $470, $471, $472, $473, $474, $475, $476, $477, $478, $479, $480, $481, $482, $483, $484, $485, $486, $487, $488, $489, $490, $491, $492, $493, $494, $495, $496, $497, $498, $499, $500, $501, $502, $503, $504, $505, $506, $507, $508, $509, $510, $511, $512, $513, $514, $515, $516, $517, $518, $519, $520, $521, $522, $523, $524, $525, $526, $527, $528, $529, $530, $531, $532, $533, $534, $535, $536, $537, $538, $539, $540, $541, $542, $543, $544, $545, $546, $547, $548, $549, $550, $551, $552, $553, $554, $555, $556, $557, $558, $559, $560, $561, $562, $563, $564, $565, $566, $567, $568, $569, $570, $571, $572, $573, $574, $575, $576, $577, $578, $579, $580, $581, $582, $583, $584, $585, $586, $587, $588, $589, $590, $591, $592, $593, $594, $595, $596, $597, $598, $599, $600, $601, $602, $603, $604, $605, $606, $607, $608, $609, $610, $611, $612, $613, $614, $615, $616, $617, $618, $619, $620, $621, $622, $623, $624, $625, $626, $627, $628, $629, $630, $631, $632, $633, $634, $635, $636, $637, $638, $639, $640, $641, $642, $643, $644, $645, $646, $647, $648, $649, $650, $651, $652, $653, $654, $655, $656, $657, $658, $659, $660, $661, $662, $663, $664, $665, $666, $667, $668, $669, $670, $671, $672, $673, $674, $675, $676, $677, $678, $679, $680, $681, $682, $683, $684, $685, $686, $687, $688, $689, $690, $691, $692, $693, $694, $695, $696, $697, $698, $699, $700, $701, $702, $703, $704, $705, $706, $707, $708, $709, $710, $711, $712, $713, $714, $715, $716, $717, $718, $719, $720, $721, $722, $723, $724, $725, $726, $727, $728, $729, $730, $731, $732, $733, $734, $735, $736, $737, $738, $739, $740, $741, $742, $743, $744, $745, $746, $747, $748, $749, $750, $751, $752, $753, $754, $755, $756, $757, $758, $759, $760, $761, $762, $763, $764, $765, $766, $767, $768, $769, $770, $771, $772, $773, $774, $775, $776, $777, $778, $779, $780, $781, $782, $783, $784, $785, $786, $787, $788, $789, $790, $791, $792, $793, $794, $795, $796, $797, $798, $799, $800, $801, $802, $803, $804, $805, $806, $807, $808, $809, $810, $811, $812, $813, $814, $815, $816, $817, $818, $819, $820, $821, $822, $823, $824, $825, $826, $827, $828, $829, $830, $831, $832, $833, $834, $835, $836, $837, $838, $839, $840, $841, $842, $843, $844, $845, $846, $847, $848, $849, $850, $851, $852, $853, $854, $855, $856, $857, $858, $859, $860, $861, $862, $863, $864, $865, $866, $867, $868, $869, $870, $871, $872, $873, $874, $875, $876, $877, $878, $879, $880, $881, $882, $883, $884, $885, $886, $887, $888, $889, $890, $891, $892, $893, $894, $895, $896, $897, $898, $899, $900, $901, $902, $903, $904, $905, $906, $907, $908, $909, $910, $911, $912, $913, $914, $915, $916, $917, $918, $919, $920, $921, $922, $923, $924, $925, $926, $927, $928, $929, $930, $931, $932, $933, $934, $935, $936, $937, $938, $939, $940, $941, $942, $943, $944, $945, $946, $947, $948, $949, $950, $951, $952, $953, $954, $955, $956, $957, $958, $959, $960, $961, $962, $963, $964, $965, $966, $967, $968, $969, $970, $971, $972, $973, $974, $975, $976, $977, $978, $979, $980, $981, $982, $983, $984, $985, $986, $987, $988, $989, $990, $991, $992, $993, $994, $995, $996, $997, $998, $999, $1000)
Covered by index on (active_job_id, created_at)
Rows: 866095
Row progression: 866095, 1

Row estimates
- active_job_id (=): 1

Existing indexes
- id PRIMARY
- active_job_id, created_at
- process_id, created_at
27 min < 0.1% 0 ms 31,354,443 flightcontrol
SELECT "flipper_features"."key" AS feature_key, "flipper_gates"."key", "flipper_gates"."value" FROM "flipper_features" LEFT OUTER JOIN "flipper_gates" ON "flipper_features"."key" = "flipper_gates"."feature_key"
26 min < 0.1% 23 ms 69,523 flightcontrol
UPDATE "conversations" SET "first_agent_reply_at" = $1, "first_responder_id" = $2, "time_to_first_response_seconds" = $3 WHERE "conversations"."id" = $4
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
26 min < 0.1% 1,443 ms 1,090 flightcontrol
SELECT COUNT(*) FROM "good_jobs" WHERE "good_jobs"."finished_at" IS NOT NULL AND "good_jobs"."error" IS NULL
25 min < 0.1% 0 ms 5,020,566 flightcontrol
SELECT "clients".* FROM "clients" WHERE "clients"."organization_id" = $1 AND "clients"."data_source_id" = $2 AND "clients"."data_source_uid" = $3 LIMIT $4
Details
CREATE INDEX CONCURRENTLY ON clients (data_source_uid)
Rows: 729582
Row progression: 729582, 1

Row estimates
- data_source_uid (=): 1
- organization_id (=): 104226
- data_source_id (=): 137249

Existing indexes
- id PRIMARY
- data_source_id
- organization_data_source_id
- organization_id
- organization_id, data_source_id, data_source_uid WHERE (data_source_id IS NOT NULL) AND (data_source_uid IS NOT NULL) UNIQUE
- organization_id, user_id WHERE user_id IS NOT NULL UNIQUE
- public_id UNIQUE
24 min < 0.1% 3,031 ms 477 flightcontrol
SELECT * FROM generate_series( date_trunc($3, $1::timestamp), date_trunc($4, $2::timestamp), $5 ) timestamp LEFT JOIN ( SELECT date_trunc($6, scheduled_at) AS scheduled_at, queue_name, count(*) AS count FROM ( SELECT "good_jobs"."queue_name", "good_jobs"."scheduled_at" FROM "good_jobs" WHERE "good_jobs"."performed_at" IS NULL AND "good_jobs"."finished_at" IS NULL AND "good_jobs"."scheduled_at" <= $7 ) sources GROUP BY date_trunc('hour', scheduled_at), queue_name ) sources ON sources.scheduled_at = timestamp ORDER BY timestamp ASC
24 min < 0.1% 0 ms 13,768,046 flightcontrol
SELECT "clients".* FROM "clients" INNER JOIN "conversation_customers" ON "clients"."id" = "conversation_customers"."client_id" WHERE "clients"."organization_id" = $1 AND "conversation_customers"."organization_id" = $2 AND "conversation_customers"."conversation_id" = $3 ORDER BY "clients"."id" ASC LIMIT $4
24 min < 0.1% 1 ms 2,484,376 flightcontrol
SELECT "conversation_part_email_details".* FROM "conversation_part_email_details" WHERE "conversation_part_email_details"."organization_id" = $1 AND "conversation_part_email_details"."conversation_part_id" = $2 LIMIT $3
Covered by index on (conversation_part_id)
Rows: 907747
Row progression: 907747, 1

Row estimates
- conversation_part_id (=): 1
- organization_id (=): 151291

Existing indexes
- id PRIMARY
- conversation_part_id
- organization_id
- public_id UNIQUE
23 min < 0.1% 2 ms 892,624 flightcontrol
UPDATE "conversations" SET "channel_types" = $1 WHERE "conversations"."id" = $2
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
23 min < 0.1% 7,621 ms 181 flightcontrol
SELECT "good_jobs"."scheduled_at" FROM "good_jobs" LEFT JOIN pg_locks ON pg_locks.locktype = $3 AND pg_locks.objsubid = $4 AND pg_locks.classid = ($5 || substr(md5($6 || $7 || "good_jobs"."id"::text), $8, $9))::bit(32)::int AND pg_locks.objid = (($10 || substr(md5($11 || $12 || "good_jobs"."id"::text), $13, $14))::bit(64) << $15)::bit(32)::int WHERE "pg_locks"."locktype" IS NULL AND "good_jobs"."finished_at" IS NULL AND "good_jobs"."scheduled_at" > $1 ORDER BY "good_jobs"."scheduled_at" ASC LIMIT $2
23 min < 0.1% 0 ms 28,316,270 flightcontrol
SELECT $6 AS one FROM "conversations" WHERE "conversations"."external_id" = $1 AND "conversations"."id" != $2 AND "conversations"."data_source_id" = $3 AND "conversations"."organization_id" = $4 LIMIT $5
Details
CREATE INDEX CONCURRENTLY ON conversations (external_id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- external_id (=): 1
- organization_id (=): 169150
- data_source_id (=): 253522
- id (<>): 1522346

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
23 min < 0.1% 0 ms 36,250,585 flightcontrol
SELECT "conversation_fields".* FROM "conversation_fields" WHERE "conversation_fields"."organization_id" = $1 AND "conversation_fields"."external_id" = $2 AND "conversation_fields"."organization_data_source_id" = $3 LIMIT $4
23 min < 0.1% 0 ms 34,396,181 flightcontrol
SELECT "good_job_batches".* FROM "good_job_batches" WHERE "good_job_batches"."id" = $1 LIMIT $2
Covered by index on (id)
Rows: 225400
Row progression: 225400, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
22 min < 0.1% 1,237 ms 1,048 flightcontrol
SELECT COUNT(*) FROM "good_jobs" WHERE "good_jobs"."finished_at" IS NULL AND "good_jobs"."scheduled_at" > $1 AND ("good_jobs"."serialized_params" ->> $2) :: integer > $3
19 min < 0.1% 0 ms 2,998,706 flightcontrol
UPDATE "good_job_executions" SET "updated_at" = $1, "finished_at" = $2, "error" = $3, "error_event" = $4, "error_backtrace" = $5, "duration" = $6 WHERE "good_job_executions"."id" = $7
Covered by index on (id)
Rows: 866095
Row progression: 866095, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_job_id, created_at
- process_id, created_at
19 min < 0.1% 6 ms 189,277 flightcontrol
UPDATE "conversations" SET "updated_at" = $1, "priority" = $2 WHERE "conversations"."id" = $3
Covered by index on (id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
19 min < 0.1% 0 ms 3,308,584 flightcontrol
UPDATE "conversation_field_values" SET "value" = $1, "updated_at" = $2 WHERE "conversation_field_values"."id" = $3
Covered by index on (id)
Rows: 3463383
Row progression: 3463383, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- conversation_field_id
- conversation_id
- conversation_id, conversation_field_id UNIQUE
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
19 min < 0.1% 0 ms 2,813,649 flightcontrol
UPDATE "good_jobs" SET "performed_at" = $1, "serialized_params" = $2, "scheduled_at" = $3, "created_at" = $4, "updated_at" = $5 WHERE "good_jobs"."id" = $6
Covered by index on (id)
Rows: 533022
Row progression: 533022, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
19 min < 0.1% 161 ms 7,064 flightcontrol
SELECT COUNT(*) FROM "conversations" INNER JOIN "customer_complaint_conversations" ON "customer_complaint_conversations"."organization_id" = $1 AND "customer_complaint_conversations"."conversation_id" = "conversations"."id" INNER JOIN "customer_complaints" ON "customer_complaints"."organization_id" = $2 AND "customer_complaints"."id" = "customer_complaint_conversations"."customer_complaint_id" WHERE "conversations"."organization_id" = $3 AND "customer_complaints"."id" IS NOT NULL AND "conversations"."started_at" BETWEEN $4 AND $5
18 min < 0.1% 0 ms 3,536,508 flightcontrol
UPDATE "conversation_part_attribute_updated_by_admins" SET "public_id" = $1, "updated_at" = $2 WHERE "conversation_part_attribute_updated_by_admins"."id" = $3
Covered by index on (id)
Rows: 5667550
Row progression: 5667550, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- conversation_part_id
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
17 min < 0.1% 0 ms 47,595,163 flightcontrol
SELECT pg_advisory_unlock(($2||substr(md5($1::text), $3, $4))::bit(64)::bigint) AS unlocked
17 min < 0.1% 1 ms 845,888 flightcontrol
SELECT $4 AS one FROM "conversations" WHERE "conversations"."organization_id" = $1 AND "conversations"."public_id" = $2 LIMIT $3
Covered by index on (public_id)
Rows: 1522347
Row progression: 1522347, 1

Row estimates
- public_id (=): 1
- organization_id (=): 169150

Existing indexes
- id PRIMARY
- active_evaluation_id
- agent_knowledge_gap_id
- assignee_id
- assignee_membership_id
- channel_types GIN
- client_id
- closed_at
- company_id
- compliance_review_id
- conversation_thread_id
- conversation_upload_id WHERE conversation_upload_id IS NOT NULL UNIQUE
- customer_account_id
- customer_issue_id
- customer_issue_id, started_at, id
- data_source_id
- duplicate_of_id
- employee_id
- evaluation_state
- first_agent_reply_at
- first_agent_response_at
- first_customer_message_at
- first_customer_response_at
- first_responder_id
- group_id
- interaction_type
- jira_issue_key WHERE jira_issue_key IS NOT NULL
- jira_request_type_id
- jira_service_desk_id
- organization_data_source_id
- organization_id
- organization_id, closed_at WHERE handling_time IS NOT NULL
- organization_id, closed_at) INCLUDE (id, handling_time WHERE handling_time IS NOT NULL
- organization_id, data_source_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id, interaction_type, complaint_risk_level
- organization_id, interaction_type, complaint_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, compliance_risk_level
- organization_id, interaction_type, compliance_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, dispute_risk_level
- organization_id, interaction_type, dispute_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, product_issue_risk_level
- organization_id, interaction_type, product_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, qa_risk_level
- organization_id, interaction_type, risk_level
- organization_id, interaction_type, risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, service_issue_risk_level
- organization_id, interaction_type, service_issue_risk_level, external_created_at DESC, created_at DESC
- organization_id, interaction_type, started_at
- organization_id, interaction_type, started_at, active_evaluation_id
- organization_id, interaction_type, ticket_status, qa_risk_level, external_created_at DESC, created_at DESC
- organization_id, started_at
- organization_id, started_at) INCLUDE (qa_score_effective
- public_id UNIQUE
- qa_auto_fail
- qa_score_updated_at
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- requester_employee_id
- requester_id
- resolved_at
- resolver_id
- search_vector GIN
- sla_breach_last_checked_at
- started_at
- ticket_status
- transcription_state
- translation_state
- zendesk_brand_id
16 min < 0.1% 1 ms 794,692 flightcontrol
INSERT INTO "conversation_customers" ("organization_id", "public_id", "conversation_id", "client_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id"
16 min < 0.1% 0 ms 9,189,166 flightcontrol
SELECT DISTINCT "conversation_parts"."type" FROM "conversation_parts" WHERE "conversation_parts"."organization_id" = $1 AND "conversation_parts"."conversation_id" = $2 AND "conversation_parts"."type" IN ($3, $4, $5)
Details
CREATE INDEX CONCURRENTLY ON conversation_parts (conversation_id, type)
Rows: 26678064
Row progression: 26678064, 98, 11

Row estimates
- conversation_id (=): 98
- type (=): 2964229
- organization_id (=): 5335613

Existing indexes
- id PRIMARY
- author_client_id
- author_employee_id
- author_employee_id, author_type
- conversation_id
- conversation_id, author_type
- data_source_id
- external_created_at
- organization_data_source_id
- organization_data_source_id, external_id WHERE (organization_data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id
- organization_id, data_source_id, conversation_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- public_id UNIQUE
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- type
15 min < 0.1% 0 ms 36,977,028 flightcontrol
SELECT "data_sources".* FROM "data_sources" WHERE "data_sources"."key" = $1 LIMIT $2
15 min < 0.1% 0 ms 2,060,159 flightcontrol
INSERT INTO "conversation_field_values" ("organization_id", "conversation_id", "conversation_field_id", "public_id", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"
15 min < 0.1% 0 ms 7,833,770 flightcontrol
SELECT "conversation_part_assignments".* FROM "conversation_part_assignments" WHERE "conversation_part_assignments"."organization_id" = $1 AND "conversation_part_assignments"."conversation_part_id" = $2 LIMIT $3
Covered by index on (conversation_part_id)
Rows: 1590645
Row progression: 1590645, 1

Row estimates
- conversation_part_id (=): 1
- organization_id (=): 397661

Existing indexes
- id PRIMARY
- conversation_part_id
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
13 min < 0.1% 1 ms 735,149 flightcontrol
INSERT INTO "conversation_agents" ("organization_id", "conversation_id", "employee_id", "public_id", "created_at", "updated_at", "eligible_for_qa_evaluation") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"
13 min < 0.1% 0 ms 2,481,779 flightcontrol
UPDATE "conversation_field_values" SET "public_id" = $1, "updated_at" = $2 WHERE "conversation_field_values"."id" = $3
Covered by index on (id)
Rows: 3463383
Row progression: 3463383, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- conversation_field_id
- conversation_id
- conversation_id, conversation_field_id UNIQUE
- organization_id
- public_id WHERE public_id IS NOT NULL UNIQUE
13 min < 0.1% 0 ms 21,172,592 flightcontrol
SELECT "organization_data_sources".* FROM "organization_data_sources" WHERE "organization_data_sources"."id" = $1 LIMIT $2
12 min < 0.1% 1 ms 535,538 flightcontrol
SELECT $4 AS one FROM "conversation_part_email_details" WHERE "conversation_part_email_details"."organization_id" = $1 AND "conversation_part_email_details"."public_id" = $2 LIMIT $3
Covered by index on (public_id)
Rows: 907747
Row progression: 907747, 1

Row estimates
- public_id (=): 1
- organization_id (=): 151291

Existing indexes
- id PRIMARY
- conversation_part_id
- organization_id
- public_id UNIQUE
12 min < 0.1% 0 ms 22,608,449 flightcontrol
SELECT "conversation_fields".* FROM "conversation_fields" WHERE "conversation_fields"."organization_id" = $1 AND "conversation_fields"."id" = $2 LIMIT $3
12 min < 0.1% 0 ms 2,569,631 flightcontrol
SELECT "conversation_parts".* FROM "conversation_parts" WHERE "conversation_parts"."organization_id" = $1 AND "conversation_parts"."conversation_id" = $2 AND "conversation_parts"."type" IN ($3, $4) AND "conversation_parts"."author_type" = $5 AND "conversation_parts"."external_created_at" IS NOT NULL ORDER BY "conversation_parts"."external_created_at" ASC LIMIT $6
Details
CREATE INDEX CONCURRENTLY ON conversation_parts (conversation_id, type)
Rows: 26678064
Row progression: 26678064, 98, 11

Row estimates
- conversation_id (=): 98
- type (=): 2964229
- organization_id (=): 5335613
- author_type (=): 13339032
- external_created_at (not_null): 26678064
- external_created_at (sort): 11

Existing indexes
- id PRIMARY
- author_client_id
- author_employee_id
- author_employee_id, author_type
- conversation_id
- conversation_id, author_type
- data_source_id
- external_created_at
- organization_data_source_id
- organization_data_source_id, external_id WHERE (organization_data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- organization_id
- organization_id, data_source_id, conversation_id, external_id WHERE (data_source_id IS NOT NULL) AND (external_id IS NOT NULL) UNIQUE
- public_id UNIQUE
- reference_id WHERE reference_id IS NOT NULL UNIQUE
- type
11 min < 0.1% 0 ms 5,972,164 flightcontrol
SELECT "conversation_agents".* FROM "conversation_agents" WHERE "conversation_agents"."organization_id" = $1 AND "conversation_agents"."conversation_id" = $2 AND "conversation_agents"."employee_id" = $3 LIMIT $4
Covered by index on (conversation_id, employee_id)
Rows: 2636642
Row progression: 2636642, 2

Row estimates
- conversation_id (=): 2
- employee_id (=): 6248
- organization_id (=): 376663

Existing indexes
- id PRIMARY
- conversation_id
- conversation_id, employee_id UNIQUE
- eligible_for_qa_evaluation
- employee_id
- organization_id
- organization_id, conversation_id, employee_id UNIQUE
- organization_id, employee_id, conversation_id
- public_id WHERE public_id IS NOT NULL UNIQUE
11 min < 0.1% 0 ms 1,387,063 flightcontrol
SELECT "good_job_processes".* FROM "good_job_processes" LEFT JOIN pg_locks ON pg_locks.locktype = $3 AND pg_locks.objsubid = $4 AND pg_locks.classid = ($5 || substr(md5($6 || $7 || "good_job_processes"."id"::text), $8, $9))::bit(32)::int AND pg_locks.objid = (($10 || substr(md5($11 || $12 || "good_job_processes"."id"::text), $13, $14))::bit(64) << $15)::bit(32)::int WHERE ("good_job_processes"."lock_type" = $1 AND "pg_locks"."locktype" IS NULL OR "good_job_processes"."lock_type" IS NULL AND "good_job_processes"."updated_at" < $16) ORDER BY "good_job_processes"."id" ASC LIMIT $2
11 min < 0.1% 0 ms 6,167,973 flightcontrol
SELECT "jira_issue_request_field_values".* FROM "jira_issue_request_field_values" WHERE "jira_issue_request_field_values"."organization_id" = $1 AND "jira_issue_request_field_values"."jira_issue_id" = $2 AND "jira_issue_request_field_values"."jira_request_type_field_id" = $3 LIMIT $4
Covered by index on (jira_issue_id)
Rows: 139159
Row progression: 139159, 8

Row estimates
- jira_issue_id (=): 8
- jira_request_type_field_id (=): 186
- organization_id (=): 27832

Existing indexes
- id PRIMARY
- jira_issue_id
- jira_issue_id, jira_request_type_field_id UNIQUE
- jira_request_type_field_id
- organization_id
10 min < 0.1% 0 ms 1,635,567 flightcontrol
UPDATE "conversation_agents" SET "public_id" = $1, "updated_at" = $2 WHERE "conversation_agents"."id" = $3
Covered by index on (id)
Rows: 2636642
Row progression: 2636642, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- conversation_id
- conversation_id, employee_id UNIQUE
- eligible_for_qa_evaluation
- employee_id
- organization_id
- organization_id, conversation_id, employee_id UNIQUE
- organization_id, employee_id, conversation_id
- public_id WHERE public_id IS NOT NULL UNIQUE
10 min < 0.1% 0 ms 9,609,124 flightcontrol
SELECT $3 AS one FROM "good_jobs" WHERE "good_jobs"."batch_id" = $1 AND "good_jobs"."finished_at" IS NULL LIMIT $2
Details
CREATE INDEX CONCURRENTLY ON good_jobs (batch_id)
Rows: 533022
Row progression: 533022, 3

Row estimates
- batch_id (=): 3
- finished_at (null): 150366

Existing indexes
- id PRIMARY
- active_job_id, created_at
- batch_callback_id WHERE batch_callback_id IS NOT NULL
- batch_id WHERE batch_id IS NOT NULL
- concurrency_key, created_at
- concurrency_key WHERE finished_at IS NULL
- cron_key, created_at WHERE cron_key IS NOT NULL
- cron_key, cron_at WHERE cron_key IS NOT NULL UNIQUE
- finished_at WHERE finished_at IS NOT NULL
- job_class
- labels WHERE labels IS NOT NULL GIN
- locked_by_id WHERE locked_by_id IS NOT NULL
- priority, created_at WHERE finished_at IS NULL
- priority, scheduled_at WHERE (finished_at IS NULL) AND (locked_by_id IS NULL)
- priority DESC NULLS LAST, created_at WHERE finished_at IS NULL
- queue_name, scheduled_at WHERE finished_at IS NULL
- scheduled_at WHERE finished_at IS NULL
10 min < 0.1% 0 ms 1,301,128 flightcontrol
INSERT INTO "pg_search_documents" ("content", "searchable_type", "searchable_id", "created_at", "updated_at", "organization_id", "group_id") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"