PgHero

Queries

Total Time Average Time Calls
6,612 min 94% 261,162 ms 1,519 postgres
SELECT config AS config
        FROM upload
        WHERE email IS NULL AND created_at < NOW() - INTERVAL $1
        AND created_at > NOW() - INTERVAL $2
Details
CREATE INDEX CONCURRENTLY ON upload (created_at)
Rows: 11452388
Row progression: 11452388, 1145239

Row estimates
- created_at (>): 1145239
- created_at (<): 1145239
- email (null): 2571061

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
213 min 3% 6 ms 2,011,139 postgres
Update Upload set status= $1, audio_links= $2, statistics = $3, ended_at= $4::timestamp, config= $5, edits= $6, export_links= $7 where id = uuid($8)
Covered by index on (id)
Rows: 11452388
Row progression: 11452388, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
32 min 0.5% 23 ms 84,180 postgres
UPDATE "upload" SET "user_id"=$1,"email"=$2 WHERE "id"=$3
Covered by index on (id)
Rows: 11452388
Row progression: 11452388, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
17 min 0.2% 785 ms 1,333 postgres
DELETE FROM "user" WHERE "id"=$1
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
16 min 0.2% 714 ms 1,332 admin
DELETE FROM ONLY "public"."files" WHERE $1 OPERATOR(pg_catalog.=) "user_id"
14 min 0.2% 544 ms 1,600 postgres
SELECT CASE WHEN $3 < LENGTH(CAST("public"."upload"."audio_samples" AS TEXT)) THEN $4 ELSE "public"."upload"."audio_samples" END AS "audio_samples", CASE WHEN $5 < LENGTH(CAST("public"."upload"."export_links" AS TEXT)) THEN $6 ELSE "public"."upload"."export_links" END AS "export_links", CASE WHEN $7 < LENGTH(CAST("public"."upload"."edits" AS TEXT)) THEN $8 ELSE "public"."upload"."edits" END AS "edits", CASE WHEN $9 < LENGTH(CAST("public"."upload"."config" AS TEXT)) THEN $10 ELSE "public"."upload"."config" END AS "config", CASE WHEN $11 < LENGTH(CAST("public"."upload"."timeline_links" AS TEXT)) THEN $12 ELSE "public"."upload"."timeline_links" END AS "timeline_links", CASE WHEN $13 < LENGTH(CAST("public"."upload"."statistics" AS TEXT)) THEN $14 ELSE "public"."upload"."statistics" END AS "statistics", CASE WHEN $15 < LENGTH(CAST("public"."upload"."audio_links" AS TEXT)) THEN $16 ELSE "public"."upload"."audio_links" END AS "audio_links" FROM "public"."upload" INNER JOIN ((SELECT "public"."upload"."id" FROM "public"."upload" ORDER BY "public"."upload"."id" ASC LIMIT $1) UNION ALL (SELECT "public"."upload"."id" FROM "public"."upload" ORDER BY "public"."upload"."id" DESC LIMIT $2)) AS "result" ON ("result"."id" = "public"."upload"."id")
10 min 0.1% 0 ms 1,403,568 postgres
INSERT INTO "upload" ("id","email","created_at","ended_at","statistics","edits","config","export_links","audio_links","timeline_links","audio_samples","length_audio","status","task_id","source","user_id") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16)
8 min 0.1% 0 ms 1,798,571 postgres
INSERT INTO "files" ("id","created_at","filename_path","user_id") VALUES ($1,$2,$3,$4)
7 min < 0.1% 0 ms 54,149,247 postgres
SELECT pg_advisory_unlock_all()
6 min < 0.1% 0 ms 1,339,962 postgres
SELECT COUNT(*) FROM "upload" WHERE "user_id"=$1
Covered by index on (user_id, created_at DESC)
Rows: 11452388
Row progression: 11452388, 802

Row estimates
- user_id (=): 802

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
6 min < 0.1% 0 ms 2,767,359 postgres
SELECT COUNT(*) FROM "files" WHERE "filename_path"=$1
Covered by index on (filename_path)
Rows: 7564130
Row progression: 7564130, 1

Row estimates
- filename_path (=): 1

Existing indexes
- id PRIMARY
- filename_path
6 min < 0.1% 0 ms 1,153,766 postgres
UPDATE "upload" SET "task_id"=$1 WHERE "id"=$2
Covered by index on (id)
Rows: 11452388
Row progression: 11452388, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
5 min < 0.1% 0 ms 4,213,465 postgres
SELECT $3 FROM "upload" WHERE "user_id"=$1 LIMIT $2
Covered by index on (user_id, created_at DESC)
Rows: 11452388
Row progression: 11452388, 802

Row estimates
- user_id (=): 802

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
5 min < 0.1% 0 ms 565,972 postgres
SELECT "status" "status","config" "config" FROM "upload" WHERE "task_id"=$1 AND "user_id"=$2 LIMIT $3
Covered by index on (task_id)
Rows: 11452388
Row progression: 11452388, 1

Row estimates
- task_id (=): 1
- user_id (=): 802

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
4 min < 0.1% 0 ms 878,326 postgres
UPDATE "upload" SET "task_id"=$1,"config"=$2 WHERE "id"=$3
Covered by index on (id)
Rows: 11452388
Row progression: 11452388, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
2 min < 0.1% 0 ms 1,357,399 postgres
UPDATE "user" SET "recurring_credit"=$1,"credit"=$2 WHERE "auth_id"=$3 AND "email"=$4
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1
- email (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
2 min < 0.1% 0 ms 2,926,191 admin
SELECT $2 FROM ONLY "public"."user" x WHERE "id" OPERATOR(pg_catalog.=) $1 FOR KEY SHARE OF x
1 min < 0.1% 13 ms 4,161 postgres
SELECT
            stats.key AS key,
            SUM((stats.value)::numeric) AS total
        FROM upload u
        CROSS JOIN LATERAL jsonb_each(COALESCE(u.config->$4, $5::jsonb)) AS stats(key, value)
        WHERE u.user_id = $1
          AND u.status = $6
          AND u.created_at >= $2
          AND u.created_at < $3
          AND jsonb_typeof(stats.value) = $7
        GROUP BY stats.key
1 min < 0.1% 36 ms 1,332 admin
DELETE FROM ONLY "public"."configuration" WHERE $1 OPERATOR(pg_catalog.=) "user_id"
1 min < 0.1% 0 ms 146,523 postgres
INSERT INTO "user" ("auth_id","email","recurring_credit","credit","created_at","meta") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "id"
1 min < 0.1% 35 ms 867 postgres
SELECT "name","user_id","settings","id","upload_type","description" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 35 ms 834 postgres
SELECT "id","settings","description","user_id","name","upload_type" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 35 ms 828 postgres
SELECT "upload_type","user_id","id","name","settings","description" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 35 ms 772 postgres
SELECT "settings","upload_type","description","name","user_id","id" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 35 ms 777 postgres
SELECT "description","settings","id","upload_type","user_id","name" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 3 ms 8,743 postgres
SELECT "id" "id","paddle_email" "paddle_email","product_id" "product_id","paddle_order_id" "paddle_order_id","product_name" "product_name","created_at" "created_at" FROM "singlepayment" WHERE "user_id"=$1 ORDER BY "created_at" DESC
Details
CREATE INDEX CONCURRENTLY ON singlepayment (user_id)
Rows: 8267
Row progression: 8267, 1

Row estimates
- user_id (=): 1
- created_at (sort): 1

Existing indexes
- id PRIMARY
0 min < 0.1% 16 ms 1,600 postgres
SELECT "c"."column_name" AS "name", CASE WHEN "c"."udt_schema" IN ($3, $4) THEN FORMAT($5, "c"."udt_name") ELSE FORMAT($6, "c"."udt_schema", "c"."udt_name") END AS "database-type", "c"."ordinal_position" - $7 AS "database-position", "c"."table_schema" AS "table-schema", "c"."table_name" AS "table-name", "pk"."column_name" IS NOT NULL AS "pk?", COL_DESCRIPTION(CAST(CAST(FORMAT($8, CAST("c"."table_schema" AS TEXT), CAST("c"."table_name" AS TEXT)) AS REGCLASS) AS OID), "c"."ordinal_position") AS "field-comment", (("column_default" IS NULL) OR (LOWER("column_default") = $9)) AND ("is_nullable" = $10) AND NOT ((("column_default" IS NOT NULL) AND ("column_default" LIKE $11)) OR ("is_identity" <> $12)) AS "database-required", (("column_default" IS NOT NULL) AND ("column_default" LIKE $13)) OR ("is_identity" <> $14) AS "database-is-auto-increment" FROM "information_schema"."columns" AS "c" LEFT JOIN (SELECT "tc"."table_schema", "tc"."table_name", "kc"."column_name" FROM "information_schema"."table_constraints" AS "tc" INNER JOIN "information_schema"."key_column_usage" AS "kc" ON ("tc"."constraint_name" = "kc"."constraint_name") AND ("tc"."table_schema" = "kc"."table_schema") AND ("tc"."table_name" = "kc"."table_name") WHERE "tc"."constraint_type" = $15) AS "pk" ON ("c"."table_schema" = "pk"."table_schema") AND ("c"."table_name" = "pk"."table_name") AND ("c"."column_name" = "pk"."column_name") WHERE c.table_schema !~ $16 AND ("c"."table_schema" IN ($1)) UNION ALL SELECT "pa"."attname" AS "name", CASE WHEN "ptn"."nspname" IN ($17, $18) THEN FORMAT($19, "pt"."typname") ELSE FORMAT($20, "ptn"."nspname", "pt"."typname") END AS "database-type", "pa"."attnum" - $21 AS "database-position", "pn"."nspname" AS "table-schema", "pc"."relname" AS "table-name", $22 AS "pk?", $23 AS "field-comment", $24 AS "database-required", $25 AS "database-is-auto-increment" FROM "pg_catalog"."pg_class" AS "pc" INNER JOIN "pg_catalog"."pg_namespace" AS "pn" ON "pn"."oid" = "pc"."relnamespace" INNER JOIN "pg_catalog"."pg_attribute" AS "pa" ON "pa"."attrelid" = "pc"."oid" INNER JOIN "pg_catalog"."pg_type" AS "pt" ON "pt"."oid" = "pa"."atttypid" INNER JOIN "pg_catalog"."pg_namespace" AS "ptn" ON "ptn"."oid" = "pt"."typnamespace" WHERE ("pc"."relkind" = $26) AND ("pa"."attnum" >= $27) AND ("pn"."nspname" IN ($2)) ORDER BY "table-schema" ASC, "table-name" ASC, "database-position" ASC
0 min < 0.1% 0 ms 231,760 postgres
UPDATE "user" SET "auth_id"=$1,"email"=$2,"recurring_credit"=$3,"credit"=$4,"created_at"=$5,"meta"=$6 WHERE "id"=$7
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 13 ms 1,600 postgres
SELECT CASE WHEN $3 < LENGTH(CAST("public"."configuration"."settings" AS TEXT)) THEN $4 ELSE "public"."configuration"."settings" END AS "settings" FROM "public"."configuration" INNER JOIN ((SELECT "public"."configuration"."id" FROM "public"."configuration" ORDER BY "public"."configuration"."id" ASC LIMIT $1) UNION ALL (SELECT "public"."configuration"."id" FROM "public"."configuration" ORDER BY "public"."configuration"."id" DESC LIMIT $2)) AS "result" ON ("result"."id" = "public"."configuration"."id")
0 min < 0.1% 35 ms 597 postgres
SELECT "settings","upload_type","name","id","user_id","description" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 2 ms 12,604 postgres
SELECT "key_id" "key_id","description" "description","created_at" "created_at","last_used_at" "last_used_at" FROM "key" WHERE "user_id"=$1 ORDER BY "created_at" DESC
Details
CREATE INDEX CONCURRENTLY ON key (user_id)
Rows: 2941
Row progression: 2941, 1

Row estimates
- user_id (=): 1
- created_at (sort): 1

Existing indexes
- id PRIMARY
- hashed_api_key UNIQUE
- key_id UNIQUE
0 min < 0.1% 0 ms 182,580 postgres
UPDATE "user" SET "recurring_credit"=$1 WHERE "auth_id"=$2 AND "email"=$3
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1
- email (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 2 ms 8,743 postgres
SELECT "id" "id","paddle_subscription_id" "paddle_subscription_id","paddle_plan_id" "paddle_plan_id","paddle_status" "paddle_status","paddle_next_bill_date" "paddle_next_bill_date","paddle_cancelled_at" "paddle_cancelled_at","created_at" "created_at","paddle_user_id" "paddle_user_id" FROM "subscription" WHERE "user_id"=$1 ORDER BY "created_at" DESC
Details
CREATE INDEX CONCURRENTLY ON subscription (user_id)
Rows: 3456
Row progression: 3456, 1

Row estimates
- user_id (=): 1
- created_at (sort): 1

Existing indexes
- id PRIMARY
0 min < 0.1% 1 ms 20,000 postgres
SELECT
            COUNT(*) FILTER (WHERE COALESCE(u.source, u.config->>$4, (u.config->$5->>$6), $7) = $8) AS api_calls,
            SUM(CASE WHEN COALESCE(u.source, u.config->>$9, (u.config->$10->>$11), $12) = $13 AND u.status IN ($14, $15) THEN $16 ELSE $17 END) AS error_calls,
            AVG(EXTRACT($18 FROM (u.ended_at - u.created_at))) FILTER (
                WHERE COALESCE(u.source, u.config->>$19, (u.config->$20->>$21), $22) = $23
                  AND u.status = $24
                  AND u.ended_at IS NOT NULL
            ) AS avg_processing
        FROM upload u
        WHERE u.user_id = $1
          AND u.created_at >= $2
          AND u.created_at < $3
Covered by index on (user_id, created_at)
Rows: 11452388
Row progression: 11452388, 802, 80

Row estimates
- user_id (=): 802
- created_at (>=): 1145239
- created_at (<): 1145239

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
0 min < 0.1% 38 ms 292 postgres
SELECT "id","description","settings","user_id","name","upload_type" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 37 ms 278 postgres
SELECT "description","id","settings","name","user_id","upload_type" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 0 ms 21,178 postgres
SELECT * FROM (SELECT current_database() AS current_database, n.nspname,c.relname,a.attname,a.atttypid,a.attnotnull  OR (t.typtype = $1 AND t.typnotnull) AS attnotnull,a.atttypmod,a.attlen,t.typtypmod,row_number() OVER (PARTITION BY a.attrelid ORDER BY a.attnum) AS attnum, nullif(a.attidentity, $2) as attidentity,nullif(a.attgenerated, $3) as attgenerated,pg_catalog.pg_get_expr(def.adbin, def.adrelid) AS adsrc,dsc.description,t.typbasetype,t.typtype  FROM pg_catalog.pg_namespace n  JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid)  JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid)  JOIN pg_catalog.pg_type t ON (a.atttypid = t.oid)  LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum)  LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid)  LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname=$4)  LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname=$5)  WHERE c.relkind in ($6,$7,$8,$9,$10) and a.attnum > $11 AND NOT a.attisdropped  AND n.nspname LIKE $12 AND c.relname LIKE $13) c WHERE $14  ORDER BY nspname,c.relname,attnum
0 min < 0.1% 39 ms 240 postgres
SELECT "upload_type","description","settings","name","id","user_id" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 6 ms 1,600 postgres
SELECT CASE WHEN $3 < LENGTH(CAST("public"."user"."meta" AS TEXT)) THEN $4 ELSE "public"."user"."meta" END AS "meta" FROM "public"."user" INNER JOIN ((SELECT "public"."user"."id" FROM "public"."user" ORDER BY "public"."user"."id" ASC LIMIT $1) UNION ALL (SELECT "public"."user"."id" FROM "public"."user" ORDER BY "public"."user"."id" DESC LIMIT $2)) AS "result" ON ("result"."id" = "public"."user"."id")
0 min < 0.1% 0 ms 21,178 postgres
SELECT        result.TABLE_CAT AS "TABLE_CAT",        result.TABLE_SCHEM AS "TABLE_SCHEM",        result.TABLE_NAME AS "TABLE_NAME",        result.COLUMN_NAME AS "COLUMN_NAME",        result.KEY_SEQ AS "KEY_SEQ",        result.PK_NAME AS "PK_NAME"FROM      (SELECT current_database() AS TABLE_CAT, n.nspname AS TABLE_SCHEM,   ct.relname AS TABLE_NAME, a.attname AS COLUMN_NAME,   (information_schema._pg_expandarray(i.indkey)).n AS KEY_SEQ, ci.relname AS PK_NAME,   information_schema._pg_expandarray(i.indkey) AS KEYS, a.attnum AS A_ATTNUM, i.indnkeyatts as KEY_COUNT FROM pg_catalog.pg_class ct   JOIN pg_catalog.pg_attribute a ON (ct.oid = a.attrelid)   JOIN pg_catalog.pg_namespace n ON (ct.relnamespace = n.oid)   JOIN pg_catalog.pg_index i ON ( a.attrelid = i.indrelid)   JOIN pg_catalog.pg_class ci ON (ci.oid = i.indexrelid) WHERE $1  AND n.nspname = $2 AND ct.relname = $3 AND i.indisprimary  ) result where  result.A_ATTNUM = (result.KEYS).x AND result.KEY_SEQ <= KEY_COUNT  ORDER BY result.table_name, result.pk_name, result.key_seq
0 min < 0.1% 1 ms 9,161 postgres
INSERT INTO "configuration" ("name","description","settings","upload_type","user_id") VALUES ($1,$2,$3,$4,$5) RETURNING "id"
0 min < 0.1% 2 ms 4,161 postgres
SELECT
            date_trunc($4, u.created_at) AS bucket,
            COUNT(*) AS total_uploads,
            SUM(u.length_audio) AS total_credits,
            SUM(CASE WHEN COALESCE(u.source, u.config->>$5, (u.config->$6->>$7), $8) = $9 THEN $10 ELSE $11 END) AS ui_uploads,
            SUM(CASE WHEN COALESCE(u.source, u.config->>$12, (u.config->$13->>$14), $15) = $16 THEN u.length_audio ELSE $17 END) AS ui_credits,
            SUM(CASE WHEN COALESCE(u.source, u.config->>$18, (u.config->$19->>$20), $21) = $22 THEN $23 ELSE $24 END) AS api_uploads,
            SUM(CASE WHEN COALESCE(u.source, u.config->>$25, (u.config->$26->>$27), $28) = $29 THEN u.length_audio ELSE $30 END) AS api_credits
        FROM upload u
        WHERE u.user_id = $1
          AND u.status = $31
          AND u.created_at >= $2
          AND u.created_at < $3
        GROUP BY bucket
        ORDER BY bucket ASC
0 min < 0.1% 4 ms 1,600 postgres
SELECT CASE WHEN $3 < LENGTH(CAST("public"."key"."premissions" AS TEXT)) THEN $4 ELSE "public"."key"."premissions" END AS "premissions" FROM "public"."key" INNER JOIN ((SELECT "public"."key"."id" FROM "public"."key" ORDER BY "public"."key"."id" ASC LIMIT $1) UNION ALL (SELECT "public"."key"."id" FROM "public"."key" ORDER BY "public"."key"."id" DESC LIMIT $2)) AS "result" ON ("result"."id" = "public"."key"."id")
0 min < 0.1% 0 ms 15,468 postgres
SELECT
            COUNT(*) FILTER (WHERE COALESCE(u.source, u.config->>$4, (u.config->$5->>$6), $7) = $8) AS api_calls,
            SUM(CASE WHEN COALESCE(u.source, u.config->>$9, (u.config->$10->>$11), $12) = $13 AND u.status = $14 THEN $15 ELSE $16 END) AS successes,
            SUM(CASE WHEN COALESCE(u.source, u.config->>$17, (u.config->$18->>$19), $20) = $21 THEN u.length_audio ELSE $22 END) AS total_credits
        FROM upload u
        WHERE u.user_id = $1
          AND u.created_at >= $2
          AND u.created_at < $3
Covered by index on (user_id, created_at)
Rows: 11452388
Row progression: 11452388, 802, 80

Row estimates
- user_id (=): 802
- created_at (>=): 1145239
- created_at (<): 1145239

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
0 min < 0.1% 3 ms 1,600 postgres
SELECT CASE WHEN $3 < LENGTH(CAST("public"."aerich"."content" AS TEXT)) THEN $4 ELSE "public"."aerich"."content" END AS "content" FROM "public"."aerich" INNER JOIN ((SELECT "public"."aerich"."id" FROM "public"."aerich" ORDER BY "public"."aerich"."id" ASC LIMIT $1) UNION ALL (SELECT "public"."aerich"."id" FROM "public"."aerich" ORDER BY "public"."aerich"."id" DESC LIMIT $2)) AS "result" ON ("result"."id" = "public"."aerich"."id")
0 min < 0.1% 62 ms 73 postgres
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.1% 0 ms 16,061 postgres
Select user_id from Upload where id = $1
Covered by index on (id)
Rows: 11452388
Row progression: 11452388, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
0 min < 0.1% 38 ms 108 postgres
SELECT "upload_type","description","user_id","settings","name","id" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 0 ms 8,343 postgres
Update "user" set credit= $1 where id = $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 746,185 postgres
SELECT * FROM pg_catalog.unnest($1) WITH ORDINALITY
0 min < 0.1% 2 ms 1,446 postgres
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 < 0.1% 2 ms 1,600 postgres
with table_privileges as (
 select
   $1 as role,
   t.schemaname as schema,
   t.objectname as table,
   pg_catalog.has_any_column_privilege(current_user, $2 || replace(t.schemaname, $3, $4) || $5 || $6 || $7 || replace(t.objectname, $8, $9) || $10,  $11) as update,
   pg_catalog.has_any_column_privilege(current_user, $12 || replace(t.schemaname, $13, $14) || $15 || $16 || $17 || replace(t.objectname, $18, $19) || $20,  $21) as select,
   pg_catalog.has_any_column_privilege(current_user, $22 || replace(t.schemaname, $23, $24) || $25 || $26 || $27 || replace(t.objectname, $28, $29) || $30,  $31) as insert,
   pg_catalog.has_table_privilege(     current_user, $32 || replace(t.schemaname, $33, $34) || $35 || $36 || $37 || replace(t.objectname, $38, $39) || $40,  $41) as delete
 from (
   select schemaname, tablename as objectname from pg_catalog.pg_tables
   union
   select schemaname, viewname as objectname from pg_catalog.pg_views
   union
   select schemaname, matviewname as objectname from pg_catalog.pg_matviews
 ) t
 where t.schemaname !~ $42
   and t.schemaname <> $43
   and pg_catalog.has_schema_privilege(current_user, t.schemaname, $44)
)
select t.*
from table_privileges t
0 min < 0.1% 1 ms 1,600 postgres
SELECT "n"."nspname" AS "schema", "c"."relname" AS "name", CASE "c"."relkind" WHEN $5 THEN $6 WHEN $7 THEN $8 WHEN $9 THEN $10 WHEN $11 THEN $12 WHEN $13 THEN $14 ELSE $15 END AS "type", "d"."description" AS "description", "stat"."n_live_tup" AS "estimated_row_count" FROM "pg_catalog"."pg_class" AS "c" INNER JOIN "pg_catalog"."pg_namespace" AS "n" ON "c"."relnamespace" = "n"."oid" LEFT JOIN "pg_catalog"."pg_description" AS "d" ON ("c"."oid" = "d"."objoid") AND ("d"."objsubid" = $1) AND ("d"."classoid" = $16::regclass) LEFT JOIN "pg_stat_user_tables" AS "stat" ON ("n"."nspname" = "stat"."schemaname") AND ("c"."relname" = "stat"."relname") WHERE ("c"."relnamespace" = "n"."oid") AND ("n"."nspname" !~ $2) AND ("n"."nspname" <> $3) AND c.relkind in ($17, $18, $19, $20, $21) AND ("n"."nspname" IN ($4)) ORDER BY "type" ASC, "schema" ASC, "name" ASC
0 min < 0.1% 37 ms 51 postgres
SELECT "user_id","id","settings","upload_type","name","description" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 0 ms 8,974 postgres
SELECT
            date_trunc($4, u.created_at) AS bucket,
            COUNT(*) FILTER (WHERE COALESCE(u.source, u.config->>$5, (u.config->$6->>$7), $8) = $9) AS api_calls
        FROM upload u
        WHERE u.user_id = $1
          AND u.created_at >= $2
          AND u.created_at < $3
        GROUP BY bucket
        ORDER BY bucket ASC
0 min < 0.1% 1 ms 1,298 postgres
UPDATE "subscription" SET "paddle_next_bill_date"=$1,"paddle_status"=$2,"paddle_plan_id"=$3 WHERE "paddle_subscription_id"=$4
Details
CREATE INDEX CONCURRENTLY ON subscription (paddle_subscription_id)
Rows: 3456
Row progression: 3456, 1

Row estimates
- paddle_subscription_id (=): 1

Existing indexes
- id PRIMARY
0 min < 0.1% 1 ms 1,332 admin
DELETE FROM ONLY "public"."singlepayment" WHERE $1 OPERATOR(pg_catalog.=) "user_id"
0 min < 0.1% 1 ms 1,906 postgres
Update Upload set status= $1, audio_links= $2, statistics = $3, ended_at= $4, config= $5, edits= $6, export_links= $7 where id = uuid($8)
Covered by index on (id)
Rows: 11452388
Row progression: 11452388, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
0 min < 0.1% 0 ms 15,175 postgres
Select credit from "user" where id = $1
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 6,905 postgres
SELECT
            SUM(CASE WHEN COALESCE(u.source, u.config->>$4, (u.config->$5->>$6), $7) = $8 AND u.status = $9 THEN u.length_audio ELSE $10 END) AS credits
        FROM upload u
        WHERE u.user_id = $1
          AND u.created_at >= $2
          AND u.created_at < $3
Covered by index on (user_id, created_at)
Rows: 11452388
Row progression: 11452388, 802, 80

Row estimates
- user_id (=): 802
- created_at (>=): 1145239
- created_at (<): 1145239

Existing indexes
- id PRIMARY
- task_id
- task_id
- user_id, created_at
- user_id, created_at DESC
0 min < 0.1% 1 ms 1,332 admin
DELETE FROM ONLY "public"."upload" WHERE $1 OPERATOR(pg_catalog.=) "user_id"
0 min < 0.1% 0 ms 14,859 postgres
SELECT "id","auth_id","email","credit","created_at","meta","recurring_credit" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 15,419 postgres
SELECT "credit","recurring_credit","created_at","meta","email","id","auth_id" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 23,296 postgres
SELECT "recurring_credit","id","meta","credit","auth_id","email","created_at" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 1 ms 1,600 postgres
SELECT "fk_ns"."nspname" AS "fk-table-schema", "fk_table"."relname" AS "fk-table-name", "fk_column"."attname" AS "fk-column-name", "pk_ns"."nspname" AS "pk-table-schema", "pk_table"."relname" AS "pk-table-name", "pk_column"."attname" AS "pk-column-name" FROM "pg_constraint" AS "c" INNER JOIN "pg_class" AS "fk_table" ON "c"."conrelid" = "fk_table"."oid" INNER JOIN "pg_namespace" AS "fk_ns" ON "c"."connamespace" = "fk_ns"."oid" INNER JOIN "pg_attribute" AS "fk_column" ON "c"."conrelid" = "fk_column"."attrelid" INNER JOIN "pg_class" AS "pk_table" ON "c"."confrelid" = "pk_table"."oid" INNER JOIN "pg_namespace" AS "pk_ns" ON "pk_table"."relnamespace" = "pk_ns"."oid" INNER JOIN "pg_attribute" AS "pk_column" ON "c"."confrelid" = "pk_column"."attrelid" WHERE fk_ns.nspname !~ $2 AND ("c"."contype" = $3::char) AND ("fk_column"."attnum" = ANY(c.conkey)) AND ("pk_column"."attnum" = ANY(c.confkey)) AND ("fk_ns"."nspname" IN ($1)) ORDER BY "fk-table-schema" ASC, "fk-table-name" ASC
0 min < 0.1% 0 ms 21,592 postgres
SELECT "recurring_credit","email","id","created_at","auth_id","meta","credit" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 12,992 postgres
SELECT "auth_id","email","recurring_credit","id","meta","credit","created_at" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 13,614 postgres
SELECT "id","email","credit","meta","created_at","auth_id","recurring_credit" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 19,486 postgres
SELECT "meta","created_at","recurring_credit","id","email","auth_id","credit" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 12,183 postgres
SELECT "credit","created_at","recurring_credit","auth_id","meta","id","email" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 19,047 postgres
SELECT "id","created_at","meta","credit","auth_id","email","recurring_credit" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 1 ms 1,332 admin
DELETE FROM ONLY "public"."key" WHERE $1 OPERATOR(pg_catalog.=) "user_id"
0 min < 0.1% 0 ms 19,319 postgres
SELECT "meta","credit","id","auth_id","created_at","email","recurring_credit" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 1 ms 1,446 postgres
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.1% 36 ms 23 postgres
SELECT "upload_type","name","user_id","settings","id","description" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 0 ms 18,779 postgres
SELECT "auth_id","email","meta","recurring_credit","created_at","id","credit" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 1 ms 1,446 postgres
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.1% 0 ms 11,995 postgres
SELECT "credit","id","email","meta","recurring_credit","created_at","auth_id" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 18,542 postgres
SELECT "meta","recurring_credit","created_at","id","auth_id","email","credit" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 6,894 postgres
UPDATE "configuration" SET "name"=$1,"description"=$2,"settings"=$3,"upload_type"=$4,"user_id"=$5 WHERE "id"=$6
Covered by index on (id)
Rows: 78010
Row progression: 78010, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
0 min < 0.1% 0 ms 18,213 postgres
SELECT "meta","created_at","auth_id","email","credit","recurring_credit","id" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 36 ms 21 postgres
SELECT "name","user_id","id","description","settings","upload_type" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 0 ms 11,196 postgres
SELECT "id","credit","email","recurring_credit","meta","auth_id","created_at" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 11,048 postgres
SELECT "created_at","credit","recurring_credit","meta","auth_id","email","id" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 16,935 postgres
SELECT "id","email","credit","auth_id","created_at","meta","recurring_credit" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 16,719 postgres
SELECT "email","credit","created_at","recurring_credit","meta","id","auth_id" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 1 ms 1,332 admin
DELETE FROM ONLY "public"."subscription" WHERE $1 OPERATOR(pg_catalog.=) "user_id"
0 min < 0.1% 0 ms 15,658 postgres
SELECT "id","auth_id","email","credit","created_at","meta","recurring_credit" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 35 ms 21 postgres
SELECT "settings","id","name","description","user_id","upload_type" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY
0 min < 0.1% 0 ms 15,398 postgres
SELECT "auth_id","email","recurring_credit","id","meta","credit","created_at" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 16,956 postgres
SELECT "created_at","recurring_credit","credit","meta","email","id","auth_id" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 10,342 postgres
SELECT "recurring_credit","email","created_at","meta","id","credit","auth_id" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 10,044 postgres
SELECT "id","recurring_credit","auth_id","email","meta","credit","created_at" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 10,333 postgres
SELECT "email","recurring_credit","created_at","meta","auth_id","credit","id" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 16,658 postgres
SELECT "id","meta","auth_id","created_at","credit","recurring_credit","email" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 0 ms 10,184 postgres
SELECT "auth_id","meta","recurring_credit","created_at","credit","email","id" FROM "user" WHERE "auth_id"=$1 LIMIT $2
Covered by index on (auth_id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- auth_id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 1 ms 727 postgres
INSERT INTO "singlepayment" ("paddle_email","product_id","paddle_order_id","product_name","created_at","user_id") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "id"
0 min < 0.1% 0 ms 16,017 postgres
SELECT "created_at","id","credit","auth_id","meta","email","recurring_credit" FROM "user" WHERE "id"=$1 LIMIT $2
Covered by index on (id)
Rows: 1140905
Row progression: 1140905, 1

Row estimates
- id (=): 1

Existing indexes
- id PRIMARY
- auth_id
- email
0 min < 0.1% 35 ms 20 postgres
SELECT "name","settings","id","user_id","description","upload_type" FROM "configuration" WHERE "user_id"=$1
Details
CREATE INDEX CONCURRENTLY ON configuration (user_id)
Rows: 78010
Row progression: 78010, 2

Row estimates
- user_id (=): 2

Existing indexes
- id PRIMARY