Untitled

mail@pastecode.io avatar
unknown
pgsql
2 years ago
1.6 kB
2
Indexable
Never
(0.064) SELECT "membership_group"."id", COUNT(DISTINCT "membership_hash"."id") FILTER (WHERE "membership_hash"."expires_at" >= '2022-03-10T10:03:59.638897+00:00'::timestamptz) AS "size", GREATEST("membership_group"."updated_at", MAX("membership_hash"."updated_at")) AS "updated" FROM "membership_group" LEFT OUTER JOIN "membership_hash" ON ("membership_group"."id" = "membership_hash"."group_id") WHERE "membership_group"."id" IN (SELECT U0."id" FROM "membership_group" U0 WHERE (U0."retailer_id" = 347 AND U0."deleted" = false)) GROUP BY "membership_group"."id"; args=(datetime.datetime(2022, 3, 10, 10, 3, 59, 638897, tzinfo=<UTC>), 347, False)

(0.063) SELECT "membership_group"."id", COUNT(DISTINCT "membership_membership"."id") FILTER (WHERE "membership_membership"."active" = true) AS "matched_size" FROM "membership_group" LEFT OUTER JOIN "membership_membership" ON ("membership_group"."id" = "membership_membership"."group_id") WHERE "membership_group"."id" IN (SELECT U0."id" FROM "membership_group" U0 WHERE (U0."retailer_id" = 347 AND U0."deleted" = false)) GROUP BY "membership_group"."id"; args=(True, 347, False)

(0.060) SELECT "membership_group"."created_at", "membership_group"."updated_at", "membership_group"."id", "membership_group"."name", "membership_group"."retailer_id", "membership_group"."matching_period", "membership_group"."starts_at", "membership_group"."expires_at", "membership_group"."deleted" FROM "membership_group" WHERE ("membership_group"."retailer_id" = 347 AND "membership_group"."deleted" = false); args=(347, False)