PgHero
No long running queries
Connections healthy 32
Vacuuming healthy
No columns near integer overflow
No invalid indexes
2 duplicate indexes
No suggested indexes
6 slow queries

Duplicate Indexes

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

Details
On ahoy_events
index_ahoy_events_on_user_id (user_id)
is covered by
index_ahoy_events_on_user_id_and_name (user_id, name)
On ahoy_events
index_ahoy_events_on_visit_id (visit_id)
is covered by
index_ahoy_events_on_visit_id_and_name (visit_id, name)

Slow Queries

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

Explain queries to see where to add indexes.

Total Time Average Time Calls
2 min 21% 47 ms 2,545 datakick · details
SELECT DISTINCT "brand_name" FROM "items" INNER JOIN "revisions" ON "revisions"."id" = "items"."current_revision_id" WHERE ("revisions"."brand_name" IS NOT NULL) /*application:Datakick,controller:items,action:edit*/
1 min 9% 53 ms 912 datakick · details
SELECT COUNT(*) FROM "items" INNER JOIN "revisions" ON "revisions"."id" = "items"."current_revision_id" WHERE ("revisions"."name" IS NOT NULL) AND ("items"."gtin" != $1) /*application:Datakick,controller:home,action:index*/
0 min 4% 71 ms 338 datakick · details
SELECT  $3 AS one FROM "users" WHERE LOWER("users"."username") = LOWER($1) LIMIT $2 /*application:Datakick,controller:devise/registrations,action:create*/
0 min 4% 23 ms 875 pghero_demo · details
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
0 min 2% 108 ms 113 datakick · details
SELECT  "items"."id" AS t0_r0, "items"."gtin" AS t0_r1, "items"."created_at" AS t0_r2, "items"."updated_at" AS t0_r3, "items"."current_revision_id" AS t0_r4, "revisions"."id" AS t1_r0, "revisions"."item_id" AS t1_r1, "revisions"."name" AS t1_r2, "revisions"."size" AS t1_r3, "revisions"."author" AS t1_r4, "revisions"."ip" AS t1_r5, "revisions"."user_agent" AS t1_r6, "revisions"."created_at" AS t1_r7, "revisions"."serving_size" AS t1_r8, "revisions"."servings_per_container" AS t1_r9, "revisions"."calories" AS t1_r10, "revisions"."fat" AS t1_r11, "revisions"."saturated_fat" AS t1_r12, "revisions"."trans_fat" AS t1_r13, "revisions"."cholesterol" AS t1_r14, "revisions"."sodium" AS t1_r15, "revisions"."carbohydrate" AS t1_r16, "revisions"."fiber" AS t1_r17, "revisions"."sugars" AS t1_r18, "revisions"."protein" AS t1_r19, "revisions"."format" AS t1_r20, "revisions"."pages" AS t1_r21, "revisions"."publisher" AS t1_r22, "revisions"."ingredients" AS t1_r23, "revisions"."image_url" AS t1_r24, "revisions"."brand_name" AS t1_r25, "revisions"."user_id" AS t1_r26, "revisions"."hit_id" AS t1_r27, "revisions"."worker_id" AS t1_r28, "revisions"."fat_calories" AS t1_r29, "revisions"."polyunsaturated_fat" AS t1_r30, "revisions"."monounsaturated_fat" AS t1_r31, "revisions"."potassium" AS t1_r32, "revisions"."visit_id" AS t1_r33, "revisions"."alcohol_by_volume" AS t1_r34 FROM "items" INNER JOIN "revisions" ON "revisions"."id" = "items"."current_revision_id" WHERE ("revisions"."name" IS NOT NULL) AND ("items"."gtin" != $1) ORDER BY LENGTH(gtin), gtin LIMIT $2 OFFSET $3 /*application:Datakick,controller:items,action:index*/
0 min 1% 51 ms 115 datakick · details
SELECT  DISTINCT "items"."id", "items"."id" AS alias_0 FROM "items" INNER JOIN "revisions" ON "revisions"."id" = "items"."current_revision_id" LEFT OUTER JOIN "images" ON "images"."item_id" = "items"."id" WHERE ("revisions"."name" IS NOT NULL) AND ("items"."gtin" != $1) AND ("items"."id" > $3) ORDER BY "items"."id" ASC LIMIT $2 /*application:Datakick,controller:items,action:index*/