PgHero

Queries

Total Time Average Time Calls
0 min 78% 27 ms 27 unnichat
SELECT schemaname AS schema, t.relname AS table, ix.relname AS name, regexp_replace(pg_get_indexdef(i.indexrelid), $1, $2) AS columns, regexp_replace(pg_get_indexdef(i.indexrelid), $3, $4) AS using, indisunique AS unique, indisprimary AS primary, indisvalid AS valid, indexprs::text, indpred::text, pg_get_indexdef(i.indexrelid) AS definition FROM pg_index i INNER JOIN pg_class t ON t.oid = i.indrelid INNER JOIN pg_class ix ON ix.oid = i.indexrelid LEFT JOIN pg_stat_user_indexes ui ON ui.indexrelid = i.indexrelid WHERE schemaname IS NOT NULL ORDER BY 1, 2 /*pghero*/
0 min 5% 1 ms 30 unnichat
SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
FROM pg_type as t
LEFT JOIN pg_range as r ON oid = rngtypid
WHERE
  t.typname 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)
0 min 3% 2 ms 18 unnichat
SELECT n.nspname AS table_schema, c.relname AS table, attname AS column, format_type(a.atttypid, a.atttypmod) AS column_type, pg_get_expr(d.adbin, d.adrelid) AS default_value FROM pg_catalog.pg_attribute a INNER JOIN pg_catalog.pg_class c ON c.oid = a.attrelid INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace INNER JOIN pg_catalog.pg_attrdef d ON (a.attrelid, a.attnum) = (d.adrelid, d.adnum) WHERE NOT a.attisdropped AND a.attnum > $1 AND pg_get_expr(d.adbin, d.adrelid) LIKE $2 AND n.nspname NOT LIKE $3 /*pghero*/
0 min 3% 15 ms 2 unnichat
SELECT n.nspname AS schema, c.relname AS relation, CASE c.relkind WHEN $1 THEN $2 WHEN $3 then $4 ELSE $5 END AS type, pg_table_size(c.oid) AS size_bytes FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname NOT IN ($6, $7) AND n.nspname !~ $8 AND c.relkind IN ($9, $10, $11) ORDER BY pg_table_size(c.oid) DESC, 2 ASC /*pghero*/
0 min 2% 1 ms 25 unnichat
WITH query_stats AS ( SELECT LEFT(query, $1) AS query, queryid AS query_hash, rolname AS user, ((total_plan_time + total_exec_time) / $2 / $3) AS total_minutes, ((total_plan_time + total_exec_time) / calls) AS average_time, calls FROM pg_stat_statements INNER JOIN pg_database ON pg_database.oid = pg_stat_statements.dbid INNER JOIN pg_roles ON pg_roles.oid = pg_stat_statements.userid WHERE calls > $4 AND pg_database.datname = current_database() ) SELECT query, query AS explainable_query, query_hash, query_stats.user, total_minutes, average_time, calls, total_minutes * $5 / (SELECT SUM(total_minutes) FROM query_stats) AS total_percent, (SELECT SUM(total_minutes) FROM query_stats) AS all_queries_total_minutes FROM query_stats ORDER BY "total_minutes" DESC LIMIT $6 /*pghero*/
0 min 0.9% 0 ms 30 unnichat
SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
FROM pg_type as t
LEFT JOIN pg_range as r ON oid = rngtypid
WHERE
  t.typelem 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)
0 min 0.8% 0 ms 30 unnichat
SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
FROM pg_type as t
LEFT JOIN pg_range as r ON oid = rngtypid
WHERE
  t.typtype IN ($1, $2, $3)
0 min 0.7% 0 ms 18 unnichat
SELECT n.nspname AS schema, c.relname AS table, $1 - GREATEST(AGE(c.relfrozenxid), AGE(t.relfrozenxid)) AS transactions_left FROM pg_class c INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace LEFT JOIN pg_class t ON c.reltoastrelid = t.oid WHERE c.relkind = $2 AND ($3 - GREATEST(AGE(c.relfrozenxid), AGE(t.relfrozenxid))) < $4 ORDER BY 3, 1, 2 /*pghero*/
0 min 0.5% 0 ms 18 unnichat
SELECT pid, state, application_name AS source, age(NOW(), COALESCE(query_start, xact_start)) AS duration, (wait_event IS NOT NULL) AS waiting, query, COALESCE(query_start, xact_start) AS started_at, EXTRACT($1 FROM NOW() - COALESCE(query_start, xact_start)) * $2 AS duration_ms, usename AS user, backend_type FROM pg_stat_activity WHERE state <> $3 AND pid <> pg_backend_pid() AND datname = current_database() AND NOW() - COALESCE(query_start, xact_start) > interval $4 AND query <> $5 ORDER BY COALESCE(query_start, xact_start) DESC /*pghero*/
0 min 0.4% 0 ms 34 unnichat
/* ContactPipelineRepository.countContactsPipelineColumn */ select count(distinct "contact_pipelines"."id") from "contact_pipelines" left join "contacts" on "contact_pipelines"."contactId" = "contacts"."id" where ("contact_pipelines"."pipelineId" = $1 and "contact_pipelines"."columnId" = $2 and "contact_pipelines"."status" = $3)
0 min 0.4% 2 ms 2 unnichat
SELECT pg_database_size(current_database()) /*pghero*/
0 min 0.4% 1 ms 3 unnichat
SELECT nspname AS schema, relname AS table, reltuples::bigint AS estimated_rows, pg_total_relation_size(pg_class.oid) AS size_bytes FROM pg_class INNER JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE relkind = $1 AND nspname = $2 AND relname IN ($3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18) ORDER BY 1, 2 /*pghero*/
0 min 0.4% 0 ms 30 unnichat
SET SESSION timezone TO 'UTC'
0 min 0.4% 0 ms 18 unnichat
SELECT last_value FROM "_timescaledb_catalog"."hypertable_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."tablespace_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."dimension_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."dimension_slice_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."chunk_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."chunk_column_stats_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_config"."bgw_job_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_internal"."bgw_job_stat_history_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."continuous_agg_migrate_plan_step_step_id_seq" UNION ALL SELECT last_value FROM "drizzle"."__drizzle_migrations_id_seq" /*pghero*/
0 min 0.3% 2 ms 2 unnichat
SELECT nspname AS schema, relname AS table, reltuples::bigint AS estimated_rows, pg_total_relation_size(pg_class.oid) AS size_bytes FROM pg_class INNER JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE relkind = $1 AND nspname = $2 AND relname IN ($3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) ORDER BY 1, 2 /*pghero*/
0 min 0.3% 0 ms 18 unnichat
SELECT state, COUNT(*) AS connections FROM pg_stat_activity GROUP BY 1 ORDER BY 2 DESC, 1 /*pghero*/
0 min 0.3% 0 ms 18 unnichat
SELECT n.nspname AS schema, c.relname AS sequence, has_sequence_privilege(c.oid, $1) AS readable FROM pg_class c INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind = $2 AND n.nspname NOT IN ($3, $4) /*pghero*/
0 min 0.2% 1 ms 2 unnichat
SELECT nspname AS schema, relname AS table, reltuples::bigint AS estimated_rows, pg_total_relation_size(pg_class.oid) AS size_bytes FROM pg_class INNER JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE relkind = $1 AND nspname = $2 AND relname IN ($3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) ORDER BY 1, 2 /*pghero*/
0 min 0.2% 0 ms 30 unnichat
SELECT t.oid, t.typname
FROM pg_type as t
WHERE t.typname IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
0 min 0.2% 1 ms 2 unnichat
SELECT schemaname AS schema, relname AS table, indexrelname AS index, pg_relation_size(i.indexrelid) AS size_bytes, idx_scan as index_scans FROM pg_stat_user_indexes ui INNER JOIN pg_index i ON ui.indexrelid = i.indexrelid WHERE NOT indisunique AND idx_scan <= $1 ORDER BY pg_relation_size(i.indexrelid) DESC, relname ASC /*pghero*/
0 min 0.2% 0 ms 133 unnichat
/* ContactRepository.updateInactiveAutomationContacts */ update "contacts" set "automationStatus" = $1, "resumeAutomationAt" = $2, "updatedAt" = $3 where ("contacts"."resumeAutomationAt" <= $4 and ("contacts"."automationStatus" = $5 or "contacts"."automationStatus" = $6))
0 min 0.1% 0 ms 3 unnichat
SELECT * FROM pg_stat_statements LIMIT $1 /*pghero*/
0 min 0.1% 0 ms 34 unnichat
/* ContactPipelineRepository.getContactsPipelineColumn */ select "contact_pipelines"."id", "contacts"."id", "contacts"."type", "contact_pipelines"."name", "contact_pipelines"."value", "contact_pipelines"."status", "contacts"."nameNormalized", "contacts"."email", "contacts"."instaName", "contacts"."phoneNumber", "contacts"."attendantId", "contact_pipelines"."attributedIn", "contacts"."inactive", "contacts"."archived", "contacts"."lastContact", "contacts"."unread", "contacts"."createdAt", "contact_pipelines"."createdAt", "contacts"."userId", "contacts"."connectionId", "contact_pipelines"."columnId" from "contact_pipelines" left join "contacts" on "contact_pipelines"."contactId" = "contacts"."id" where ("contact_pipelines"."pipelineId" = $1 and "contact_pipelines"."columnId" = $2 and "contact_pipelines"."status" = $3) order by "contact_pipelines"."attributedIn" desc, "contact_pipelines"."id" desc limit $4
0 min 0.1% 0 ms 16 unnichat
/* ContactPipelineRepository.countContactsPipelineColumn */ select count(distinct "contact_pipelines"."id") from "contact_pipelines" left join "contacts" on "contact_pipelines"."contactId" = "contacts"."id" where ("contact_pipelines"."pipelineId" = $1 and "contact_pipelines"."status" = $2)
0 min 0.1% 0 ms 66 unnichat
SELECT c.relname FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = ANY (current_schemas($1)) AND c.relname = $2 AND c.relkind IN ($3,$4)
0 min 0.1% 0 ms 16 unnichat
/* ContactPipelineRepository.getContactsPipelineColumn */ select "contact_pipelines"."id", "contacts"."id", "contacts"."type", "contact_pipelines"."name", "contact_pipelines"."value", "contact_pipelines"."status", "contacts"."nameNormalized", "contacts"."email", "contacts"."instaName", "contacts"."phoneNumber", "contacts"."attendantId", "contact_pipelines"."attributedIn", "contacts"."inactive", "contacts"."archived", "contacts"."lastContact", "contacts"."unread", "contacts"."createdAt", "contact_pipelines"."createdAt", "contacts"."userId", "contacts"."connectionId", "contact_pipelines"."columnId" from "contact_pipelines" left join "contacts" on "contact_pipelines"."contactId" = "contacts"."id" where ("contact_pipelines"."pipelineId" = $1 and "contact_pipelines"."status" = $2) order by "contact_pipelines"."attributedIn" desc, "contact_pipelines"."id" desc limit $3
0 min < 0.1% 1 ms 1 unnichat
WITH query_stats AS ( SELECT LEFT(query, $1) AS query, queryid AS query_hash, rolname AS user, ((total_plan_time + total_exec_time) / $2 / $3) AS total_minutes, ((total_plan_time + total_exec_time) / calls) AS average_time, calls FROM pg_stat_statements INNER JOIN pg_database ON pg_database.oid = pg_stat_statements.dbid INNER JOIN pg_roles ON pg_roles.oid = pg_stat_statements.userid WHERE calls > $4 AND pg_database.datname = current_database() ) SELECT query, query AS explainable_query, query_hash, query_stats.user, total_minutes, average_time, calls, total_minutes * $5 / (SELECT SUM(total_minutes) FROM query_stats) AS total_percent, (SELECT SUM(total_minutes) FROM query_stats) AS all_queries_total_minutes FROM query_stats ORDER BY "calls" DESC LIMIT $6 /*pghero*/
0 min < 0.1% 1 ms 1 unnichat
WITH query_stats AS ( SELECT LEFT(query, $1) AS query, queryid AS query_hash, rolname AS user, ((total_plan_time + total_exec_time) / $2 / $3) AS total_minutes, ((total_plan_time + total_exec_time) / calls) AS average_time, calls FROM pg_stat_statements INNER JOIN pg_database ON pg_database.oid = pg_stat_statements.dbid INNER JOIN pg_roles ON pg_roles.oid = pg_stat_statements.userid WHERE calls > $4 AND pg_database.datname = current_database() ) SELECT query, query AS explainable_query, query_hash, query_stats.user, total_minutes, average_time, calls, total_minutes * $5 / (SELECT SUM(total_minutes) FROM query_stats) AS total_percent, (SELECT SUM(total_minutes) FROM query_stats) AS all_queries_total_minutes FROM query_stats ORDER BY "average_time" DESC LIMIT $6 /*pghero*/
0 min < 0.1% 0 ms 18 unnichat
SELECT nsp.nspname AS schema, rel.relname AS table, con.conname AS name, fnsp.nspname AS referenced_schema, frel.relname AS referenced_table FROM pg_catalog.pg_constraint con INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid LEFT JOIN pg_catalog.pg_class frel ON frel.oid = con.confrelid LEFT JOIN pg_catalog.pg_namespace nsp ON nsp.oid = con.connamespace LEFT JOIN pg_catalog.pg_namespace fnsp ON fnsp.oid = frel.relnamespace WHERE con.convalidated = $1 /*pghero*/
0 min < 0.1% 0 ms 34 unnichat
/* ContactPipelineRepository.getContactsPipelineColumn */ select COALESCE(SUM(CAST("contact_pipelines"."value" AS DECIMAL)), $4) from "contact_pipelines" left join "contacts" on "contact_pipelines"."contactId" = "contacts"."id" where ("contact_pipelines"."pipelineId" = $1 and "contact_pipelines"."columnId" = $2 and "contact_pipelines"."status" = $3)
0 min < 0.1% 0 ms 16 unnichat
/* TagRepository.getAllTagsByConnectionId */ select "id", "name", "createdAt" from "tags" "Tags" where ("Tags"."connectionId" = $1 and "Tags"."type" = $2) order by "Tags"."createdAt" desc
0 min < 0.1% 0 ms 4 unnichat
/* ContactRepository.getReportContactCountInLastDaysPostgres */ select distinct count(*) from "contacts" where ("contacts"."connectionId" = $1 and ("contacts"."createdAt" AT TIME ZONE $4)::date >= $2::date and ("contacts"."createdAt" AT TIME ZONE $5)::date <= $3::date)
0 min < 0.1% 0 ms 9 unnichat
/* ContactPipelineRepository.getTagsByContactIdsBatch */ select "contact_tags"."contactId", COALESCE(
					array_agg(DISTINCT "tags"."name") FILTER (WHERE "tags"."name" IS NOT NULL),
					$2
				) from "contact_tags" left join "tags" on "contact_tags"."tagId" = "tags"."id" where "contact_tags"."contactId" in ($1) group by "contact_tags"."contactId"
0 min < 0.1% 0 ms 1 unnichat
SELECT schemaname AS schema, relname AS table, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze, n_dead_tup AS dead_rows, n_live_tup AS live_rows FROM pg_stat_user_tables ORDER BY 1, 2 /*pghero*/
0 min < 0.1% 0 ms 2 unnichat
SELECT pid, state, application_name AS source, age(NOW(), COALESCE(query_start, xact_start)) AS duration, (wait_event IS NOT NULL) AS waiting, query, COALESCE(query_start, xact_start) AS started_at, EXTRACT($1 FROM NOW() - COALESCE(query_start, xact_start)) * $2 AS duration_ms, usename AS user, backend_type FROM pg_stat_activity WHERE state <> $3 AND pid <> pg_backend_pid() AND datname = current_database() ORDER BY COALESCE(query_start, xact_start) DESC /*pghero*/
0 min < 0.1% 0 ms 2 unnichat
/* ContactPipelineRepository.updateContactPipeline */ update "contact_pipelines" set "status" = $1, "automations" = $2, "columnId" = $3, "lastContactPipelineId" = $4, "attributedIn" = $5, "updatedAt" = $6 where "contact_pipelines"."id" = $7
0 min < 0.1% 0 ms 2 unnichat
/* ContactPipelineRepository.getContactPipelineWithOptionalContact */ select distinct "contact_pipelines"."id", "contacts"."id", COALESCE("contacts"."name", $3), "contacts"."type", "contacts"."userId", "contacts"."connectionId", "contacts"."attendantId", "contacts"."customFields", "contacts"."email", "contacts"."phoneNumber", "contact_pipelines"."status", "contact_pipelines"."value", "contact_pipelines"."pipelineId", "contact_pipelines"."columnId", "contact_pipelines"."automations", "contact_pipelines"."attributedIn", "contact_pipelines"."createdAt", "contacts"."lastContact", "contacts"."inactive" from "contact_pipelines" left join "contacts" on "contact_pipelines"."contactId" = "contacts"."id" where "contact_pipelines"."id" = $1 limit $2
0 min < 0.1% 0 ms 1 unnichat
SELECT nspname AS schema, relname AS table, reltuples::bigint AS estimated_rows, pg_total_relation_size(pg_class.oid) AS size_bytes FROM pg_class INNER JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE relkind = $1 AND nspname = $2 AND relname IN ($3, $4, $5, $6, $7) ORDER BY 1, 2 /*pghero*/
0 min < 0.1% 0 ms 1 unnichat
SELECT pg_stat_activity.pid, datname AS database, usename AS user, application_name AS source, client_addr AS ip, state, ssl FROM pg_stat_activity LEFT JOIN pg_stat_ssl ON pg_stat_activity.pid = pg_stat_ssl.pid ORDER BY pg_stat_activity.pid /*pghero*/
0 min < 0.1% 0 ms 10 unnichat
/* DashboardAttendantMetricsRepository.getTotalAnsweredMessagesByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."lastContact" = "contacts"."lastMessage" and "contacts"."attendantId" = $4)
0 min < 0.1% 0 ms 21 unnichat
/* LiveChatRepository.getLiveChatContactCountQuery */ select COUNT(*) as "total" from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."attendantId" = $3 and "contacts"."archived" = $4)
0 min < 0.1% 0 ms 10 unnichat
/* DashboardAttendantMetricsRepository.getTotalOpenedChatsByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."attendantId" = $4)
0 min < 0.1% 0 ms 10 unnichat
/* ContactRepository.getContactsByConnectionIdCount */ select count(*) from "contacts" where "contacts"."connectionId" = $1
0 min < 0.1% 0 ms 10 unnichat
/* DashboardAttendantMetricsRepository.getTotalAnsweredMessagesByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."lastContact" = "contacts"."lastMessage" and "contacts"."attendantId" = $4 and "contacts"."lastMessage" >= $5 and "contacts"."lastMessage" < $6)
0 min < 0.1% 0 ms 10 unnichat
/* DashboardAttendantMetricsRepository.getTotalOpenedChatsByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."attendantId" = $4 and "contacts"."lastMessage" >= $5 and "contacts"."lastMessage" < $6)
0 min < 0.1% 0 ms 16 unnichat
/* ContactPipelineRepository.getContactsPipelineColumn */ select COALESCE(SUM(CAST("contact_pipelines"."value" AS DECIMAL)), $3) from "contact_pipelines" left join "contacts" on "contact_pipelines"."contactId" = "contacts"."id" where ("contact_pipelines"."pipelineId" = $1 and "contact_pipelines"."status" = $2)
0 min < 0.1% 0 ms 1 postgres
SELECT pg_stat_statements_reset()
0 min < 0.1% 0 ms 10 unnichat
/* DashboardAttendantMetricsRepository.getTotalContactsInPipelineByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."attendantId" = $2 and 
			EXISTS (
				SELECT $6
				FROM "contact_pipelines"
				WHERE ("contact_pipelines"."connectionId" = $3 and "contact_pipelines"."contactId" = "contacts"."id" and "contact_pipelines"."createdAt" >= $4 and "contact_pipelines"."createdAt" < $5)
			)
		)
0 min < 0.1% 0 ms 10 unnichat
/* DashboardAttendantMetricsRepository.getTotalNotViewedMessagesByAttendantId */ select count("unread") from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."unread" > $4 and "contacts"."attendantId" = $5 and "contacts"."lastMessage" >= $6 and "contacts"."lastMessage" < $7)
0 min < 0.1% 0 ms 6 unnichat
/* ContactRepository.getContactsByConnectionId */ select "id", "name", "email", "phoneNumber", "attendantId", "instaId", "instaName", "lastContact", "lastMessage", "automationStatus", "customFields", "profilePicUrl", "createdAt", "userId", "inactive", "connectionId", "metaWindowMarketingTime", "metaWindowUtilityTime", "userFollowsBusiness" from "contacts" where "contacts"."connectionId" = $1 order by "contacts"."createdAt" desc limit $2
0 min < 0.1% 0 ms 2 unnichat
SELECT state FROM pg_stat_replication /*pghero*/
0 min < 0.1% 0 ms 10 unnichat
/* DashboardAttendantMetricsRepository.getTotalNotViewedMessagesByAttendantId */ select count("unread") from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."unread" > $4 and "contacts"."attendantId" = $5)
0 min < 0.1% 0 ms 6 unnichat
/* ContactRepository.attachTagsToContacts */ select "contactId", "tagId" from "contact_tags" where "contact_tags"."contactId" in ($1, $2, $3, $4) order by "contact_tags"."contactId"
0 min < 0.1% 0 ms 10 unnichat
/* DashboardAttendantMetricsRepository.getTotalContactsInPipelineByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."attendantId" = $2 and 
			EXISTS (
				SELECT $4
				FROM "contact_pipelines"
				WHERE ("contact_pipelines"."connectionId" = $3 and "contact_pipelines"."contactId" = "contacts"."id")
			)
		)
0 min < 0.1% 0 ms 18 unnichat
SELECT slot_name, database, active FROM pg_replication_slots /*pghero*/
0 min < 0.1% 0 ms 30 unnichat
SET client_min_messages TO 'warning'
0 min < 0.1% 0 ms 9 unnichat
/* ContactPipelineRepository.getProductIdsByContactPipelineIdsBatch */ select "contactPipelineId", COALESCE(
					array_agg(DISTINCT "productId") FILTER (WHERE "productId" IS NOT NULL),
					$2
				) from "contact_pipeline_product" where "contact_pipeline_product"."contactPipelineId" in ($1) group by "contact_pipeline_product"."contactPipelineId"
0 min < 0.1% 0 ms 3 unnichat
SELECT schemaname AS schema, tablename AS table, attname AS column, null_frac, n_distinct FROM pg_stats WHERE schemaname = $1 AND tablename IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17) ORDER BY 1, 2, 3 /*pghero*/
0 min < 0.1% 0 ms 4 unnichat
/* EvaluationRepository.getSatisfactionByDateRange */ select TO_CHAR("createdAt", $4), CAST(AVG("evaluation") AS DECIMAL(10,2)), count(*) from "service_evaluations" where ("service_evaluations"."connectionId" = $1 and "service_evaluations"."createdAt" between $2 and $3) group by TO_CHAR("service_evaluations"."createdAt", 'DDMMYYYY')
0 min < 0.1% 0 ms 8 unnichat
/* DashboardAttendantMetricsRepository.getTotalOpenedChatsByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3)
0 min < 0.1% 0 ms 4 unnichat
/* DashboardAttendantMetricsRepository.getTotalContactsInPipelineByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and 
			EXISTS (
				SELECT $3
				FROM "contact_pipelines"
				WHERE ("contact_pipelines"."connectionId" = $2 and "contact_pipelines"."contactId" = "contacts"."id")
			)
		)
0 min < 0.1% 0 ms 2 unnichat
SELECT pid, phase FROM pg_stat_progress_vacuum WHERE datname = current_database() /*pghero*/
0 min < 0.1% 0 ms 3 unnichat
/* TagRepository.getTagsByConnectionId */ select "id", "name", "createdAt", "folderId" from "tags" "Tags" where ("Tags"."connectionId" = $1 and "Tags"."type" = $2) order by "Tags"."createdAt" desc limit $3
0 min < 0.1% 0 ms 2 unnichat
SELECT schemaname AS schema, tablename AS table, attname AS column, null_frac, n_distinct FROM pg_stats WHERE schemaname = $1 AND tablename IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) ORDER BY 1, 2, 3 /*pghero*/
0 min < 0.1% 0 ms 4 unnichat
/* DashboardAttendantMetricsRepository.getTotalContactsInPipelineByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and 
			EXISTS (
				SELECT $5
				FROM "contact_pipelines"
				WHERE ("contact_pipelines"."connectionId" = $2 and "contact_pipelines"."contactId" = "contacts"."id" and "contact_pipelines"."createdAt" >= $3 and "contact_pipelines"."createdAt" < $4)
			)
		)
0 min < 0.1% 0 ms 2 unnichat
SELECT schemaname AS schema, tablename AS table, attname AS column, null_frac, n_distinct FROM pg_stats WHERE schemaname = $1 AND tablename IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13) ORDER BY 1, 2, 3 /*pghero*/
0 min < 0.1% 0 ms 4 unnichat
/* DashboardAttendantMetricsRepository.getTotalAnsweredMessagesByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."lastContact" = "contacts"."lastMessage")
0 min < 0.1% 0 ms 1 unnichat
/* ContactPipelineRepository.getTagsByContactIdsBatch */ select "contact_tags"."contactId", COALESCE(
					array_agg(DISTINCT "tags"."name") FILTER (WHERE "tags"."name" IS NOT NULL),
					$3
				) from "contact_tags" left join "tags" on "contact_tags"."tagId" = "tags"."id" where "contact_tags"."contactId" in ($1, $2) group by "contact_tags"."contactId"
0 min < 0.1% 0 ms 4 unnichat
/* DashboardAttendantMetricsRepository.getTotalOpenedChatsByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."lastMessage" >= $4 and "contacts"."lastMessage" < $5)
0 min < 0.1% 0 ms 4 unnichat
/* DashboardAttendantMetricsRepository.getTotalAnsweredMessagesByAttendantId */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."lastContact" = "contacts"."lastMessage" and "contacts"."lastMessage" >= $4 and "contacts"."lastMessage" < $5)
0 min < 0.1% 0 ms 1 unnichat
/* ContactRepository.getContactsByConnectionIdCount */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."id" in (select "contactId" from "contact_tags" where "contact_tags"."tagId" in ($2)))
0 min < 0.1% 0 ms 4 unnichat
/* DashboardAttendantMetricsRepository.getTotalNotViewedMessagesByAttendantId */ select count("unread") from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."unread" > $4)
0 min < 0.1% 0 ms 3 unnichat
/* TagRepository.getTotalTagsCount */ select count(*) from "tags" where ("tags"."connectionId" = $1 and "tags"."type" = $2)
0 min < 0.1% 0 ms 4 unnichat
/* ContactPipelineRepository.getRevenueByConnectionAndAttributedRange */ select COALESCE(SUM(CAST("value" AS DECIMAL)), $5) from "contact_pipelines" where ("contact_pipelines"."connectionId" = $1 and "contact_pipelines"."status" = $2 and ("contact_pipelines"."attributedIn" AT TIME ZONE $6)::date >= $3::date and ("contact_pipelines"."attributedIn" AT TIME ZONE $7)::date <= $4::date)
0 min < 0.1% 0 ms 4 unnichat
/* DashboardAttendantMetricsRepository.getTotalNotViewedMessagesByAttendantId */ select count("unread") from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."archived" = $3 and "contacts"."unread" > $4 and "contacts"."lastMessage" >= $5 and "contacts"."lastMessage" < $6)
0 min < 0.1% 0 ms 1 unnichat
/* ContactRepository.getContactsByConnectionId */ select "id", "name", "email", "phoneNumber", "attendantId", "instaId", "instaName", "lastContact", "lastMessage", "automationStatus", "customFields", "profilePicUrl", "createdAt", "userId", "inactive", "connectionId", "metaWindowMarketingTime", "metaWindowUtilityTime", "userFollowsBusiness" from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."id" in (select "contactId" from "contact_tags" where "contact_tags"."tagId" in ($2, $3))) order by "contacts"."createdAt" desc limit $4
0 min < 0.1% 0 ms 1 unnichat
/* ContactPipelineRepository.getProductIdsByContactPipelineIdsBatch */ select "contactPipelineId", COALESCE(
					array_agg(DISTINCT "productId") FILTER (WHERE "productId" IS NOT NULL),
					$3
				) from "contact_pipeline_product" where "contact_pipeline_product"."contactPipelineId" in ($1, $2) group by "contact_pipeline_product"."contactPipelineId"
0 min < 0.1% 0 ms 2 unnichat
/* LiveChatRepository.getLiveChatContactListBaseQuery */ select "id", "name", "email", "phoneNumber", "lastContact", "lastMessage", "lastCtwaMessage", "instaId", "instaName", "profilePicUrl", "unread", "unRespond", "unRespondTime", "attendantId", "type" from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."attendantId" = $3 and "contacts"."archived" = $4) order by "contacts"."lastMessage" desc nulls last limit $5
0 min < 0.1% 0 ms 4 unnichat
/* ContactRepository.getContactsWithOpenWindows */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and (("contacts"."lastContact" is not null and "contacts"."lastContact" > $2) or ("contacts"."lastCtwaMessage" is not null and "contacts"."lastCtwaMessage" > $3)) and "contacts"."inactive" = $4 and "contacts"."archived" = $5)
0 min < 0.1% 0 ms 4 unnichat
/* LiveChatRepository.getLiveChatContactCountQuery */ select COUNT(*) as "total" from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2)
0 min < 0.1% 0 ms 30 unnichat
SET intervalstyle = iso_8601
0 min < 0.1% 0 ms 4 unnichat
/* EvaluationRepository.getSatisfactionByAttendantAndDate */ select "attendantId", TO_CHAR("createdAt", $4), CAST(AVG("evaluation") AS DECIMAL(10,2)), count(*) from "service_evaluations" where ("service_evaluations"."connectionId" = $1 and "service_evaluations"."attendantId" is not null and "service_evaluations"."createdAt" between $2 and $3) group by "service_evaluations"."attendantId", TO_CHAR("service_evaluations"."createdAt", 'DDMMYYYY')
0 min < 0.1% 0 ms 1 unnichat
SELECT schemaname AS schema, tablename AS table, attname AS column, null_frac, n_distinct FROM pg_stats WHERE schemaname = $1 AND tablename IN ($2, $3, $4, $5, $6) ORDER BY 1, 2, 3 /*pghero*/
0 min < 0.1% 0 ms 1 unnichat
/* ContactRepository.getContactsByConnectionIdCount */ select count(*) from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."id" in (select "contactId" from "contact_tags" where "contact_tags"."tagId" in ($2, $3)))
0 min < 0.1% 0 ms 30 unnichat
SET standard_conforming_strings = on
0 min < 0.1% 0 ms 3 unnichat
/* LiveChatRepository.getLiveChatContactCountQuery */ select COUNT(*) as "total" from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."attendantId" is null and "contacts"."archived" = $3)
0 min < 0.1% 0 ms 2 unnichat
/* ContactPipelineProductRepository.getContactPipelineProductsByContactPipelineId */ select "id", "contactPipelineId", "productId", "connectionId", "createdAt", "updatedAt", "deletedAt" from "contact_pipeline_product" "ContactPipelineProduct" where "ContactPipelineProduct"."contactPipelineId" = $1
0 min < 0.1% 0 ms 1 unnichat
/* LiveChatRepository.getLiveChatContactListBaseQuery */ select "id", "name", "email", "phoneNumber", "lastContact", "lastMessage", "lastCtwaMessage", "instaId", "instaName", "profilePicUrl", "unread", "unRespond", "unRespondTime", "attendantId", "type" from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."visible" = $2 and "contacts"."attendantId" is null and "contacts"."archived" = $3) order by "contacts"."lastMessage" desc nulls last limit $4
0 min < 0.1% 0 ms 1 unnichat
/* ContactPipelineRepository.getPipelineMetricsByPipelineId */ 
			select cp."columnId", COUNT(*)
			from contact_pipelines as cp
			inner join contacts as c on c."id" = cp."contactId"
			where cp."pipelineId" = $1
			and (
						EXISTS (
							SELECT $6 FROM contact_pipeline_attendant cpa
							WHERE cpa."contactPipelineId" = cp."id"
								AND cpa."deletedAt" IS NULL
								AND cpa."createdAt" = (
									SELECT MAX(cpa2."createdAt")
									FROM contact_pipeline_attendant cpa2
									WHERE cpa2."contactPipelineId" = cp."id"
										AND cpa2."deletedAt" IS NULL
								)
								AND cpa."attendantId" IN ($2)
						)
						OR c."attendantId" IN ($3)
					)
			and cp."attributedIn" >= $4
			and cp."attributedIn" <= $5
			group by cp."columnId"
0 min < 0.1% 0 ms 1 unnichat
/* ContactRepository.getContactsByConnectionId */ select "id", "name", "email", "phoneNumber", "attendantId", "instaId", "instaName", "lastContact", "lastMessage", "automationStatus", "customFields", "profilePicUrl", "createdAt", "userId", "inactive", "connectionId", "metaWindowMarketingTime", "metaWindowUtilityTime", "userFollowsBusiness" from "contacts" where ("contacts"."connectionId" = $1 and "contacts"."id" in (select "contactId" from "contact_tags" where "contact_tags"."tagId" in ($2))) order by "contacts"."createdAt" desc limit $3
0 min < 0.1% 0 ms 1 unnichat
/* ContactPipelineRepository.getAllContactPipelinesByPipelineId */ select distinct "contact_pipelines"."id", "contact_pipelines"."columnId", "contact_pipelines"."attributedIn", "contact_pipelines"."lastContactPipelineId" from "contact_pipelines" inner join "contacts" on "contact_pipelines"."contactId" = "contacts"."id" where ("contact_pipelines"."pipelineId" = $1 and (
						EXISTS (
							SELECT $6 FROM contact_pipeline_attendant cpa
							WHERE cpa."contactPipelineId" = "contact_pipelines"."id"
								AND cpa."deletedAt" IS NULL
								AND cpa."createdAt" = (
									SELECT MAX(cpa2."createdAt")
									FROM contact_pipeline_attendant cpa2
									WHERE cpa2."contactPipelineId" = "contact_pipelines"."id"
										AND cpa2."deletedAt" IS NULL
								)
								AND cpa."attendantId" IN ($2)
						)
						OR "contacts"."attendantId" IN ($3)
					) and "contact_pipelines"."createdAt" >= $4 and "contact_pipelines"."createdAt" <= $5)
0 min < 0.1% 0 ms 1 unnichat
/* ContactRepository.attachTagsToContacts */ select "contactId", "tagId" from "contact_tags" where "contact_tags"."contactId" in ($1) order by "contact_tags"."contactId"
0 min < 0.1% 0 ms 1 unnichat
SHOW default_statistics_target /*pghero*/
0 min < 0.1% 0 ms 1 unnichat
SHOW max_connections /*pghero*/
0 min < 0.1% 0 ms 1 unnichat
SHOW effective_cache_size /*pghero*/
0 min < 0.1% 0 ms 3 unnichat
SELECT pg_is_in_recovery() /*pghero*/
0 min < 0.1% 0 ms 3 unnichat
SHOW server_version_num /*pghero*/
0 min < 0.1% 0 ms 1 unnichat
SHOW checkpoint_completion_target /*pghero*/
0 min < 0.1% 0 ms 1 unnichat
SHOW shared_buffers /*pghero*/
0 min < 0.1% 0 ms 1 unnichat
SHOW maintenance_work_mem /*pghero*/