Seeing Slow query reports on a group related query

Created on 10 July 2024, about 2 months ago
Updated 13 July 2024, about 2 months ago

Problem/Motivation

Seeing Slow query reports on a group related query, see below. I have a site with a lot of Groups 55k+ our site uses it heavily for clients. I am trying to sort out if there is a way to optimize this, maybe adding a Index for this query or?

# Thread_id: 35397 Schema: pantheon QC_hit: No
# Query_time: 25.950513 Lock_time: 0.000099 Rows_sent: 10 Rows_examined: 55720
# Rows_affected: 0 Bytes_sent: 256
SET timestamp=1720557114;
SELECT "base_table"."revision_id" AS "revision_id", "base_table"."id" AS "id"
FROM
"groups" "base_table"
INNER JOIN "groups_field_data" "groups_field_data" ON "groups_field_data"."id" = "base_table"."id"
LEFT OUTER JOIN "group_relationship_field_data" "gcfd" ON base_table.id=gcfd.gid AND gcfd.plugin_id='group_membership' AND gcfd.entity_id='19020'
WHERE ("groups_field_data"."type" IN ('morg')) AND ("groups_field_data"."label" LIKE '%pit%' ESCAPE '\\') AND ((("groups_field_data"."status" = '0') AND ((("groups_field_data"."type" IN ('morg')) AND ("gcfd"."entity_id" IS NULL)) OR (("groups_field_data"."uid" = '19020') AND (("groups_field_data"."type" IN ('morg')) AND ("gcfd"."entity_id" IS NOT NULL))))) OR (("groups_field_data"."status" = '1') AND ((("groups_field_data"."type" IN ('morg')) AND ("gcfd"."entity_id" IS NULL)) OR (("groups_field_data"."type" IN ('morg')) AND ("gcfd"."entity_id" IS NOT NULL)))))
GROUP BY "base_table"."revision_id", "base_table"."id"
LIMIT 10 OFFSET 0;

πŸ’¬ Support request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cmcintosh

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024