Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N + 1 feedback #388

Closed
Aiden-Xi opened this issue Oct 27, 2021 · 0 comments
Closed

N + 1 feedback #388

Aiden-Xi opened this issue Oct 27, 2021 · 0 comments

Comments

@Aiden-Xi
Copy link

Aiden-Xi commented Oct 27, 2021

When calling hash_tree, there will be an N + 1 problem

(0.4ms) SELECT COUNT(*) FROM "industry_categories" INNER JOIN "industry_category_hierarchies" ON "industry_categories"."id" = "industry_category_hierarchies"."ancestor_id" WHERE "industry_categories"."deleted_at" IS NULL AND "industry_category_hierarchies"."descendant_id" = $1 AND ("industry_categories"."id" != 1418) [["descendant_id", 1418]] (0.5ms) SELECT COUNT(*) FROM "industry_categories" INNER JOIN "industry_category_hierarchies" ON "industry_categories"."id" = "industry_category_hierarchies"."ancestor_id" WHERE "industry_categories"."deleted_at" IS NULL AND "industry_category_hierarchies"."descendant_id" = $1 AND ("industry_categories"."id" != 1104) [["descendant_id", 1104]] (0.5ms) SELECT COUNT(*) FROM "industry_categories" INNER JOIN "industry_category_hierarchies" ON "industry_categories"."id" = "industry_category_hierarchies"."ancestor_id" WHERE "industry_categories"."deleted_at" IS NULL AND "industry_category_hierarchies"."descendant_id" = $1 AND ("industry_categories"."id" != 1087) [["descendant_id", 1087]] (0.6ms) SELECT COUNT(*) FROM "industry_categories" INNER JOIN "industry_category_hierarchies" ON "industry_categories"."id" = "industry_category_hierarchies"."ancestor_id" WHERE "industry_categories"."deleted_at" IS NULL AND "industry_category_hierarchies"."descendant_id" = $1 AND ("industry_categories"."id" != 1407) [["descendant_id", 1407]] (0.5ms) SELECT COUNT(*) FROM "industry_categories" INNER JOIN "industry_category_hierarchies" ON "industry_categories"."id" = "industry_category_hierarchies"."ancestor_id" WHERE "industry_categories"."deleted_at" IS NULL AND "industry_category_hierarchies"."descendant_id" = $1 AND ("industry_categories"."id" != 1406) [["descendant_id", 1406]] (0.4ms) SELECT COUNT(*) FROM "industry_categories" INNER JOIN "industry_category_hierarchies" ON "industry_categories"."id" = "industry_category_hierarchies"."ancestor_id" WHERE "industry_categories"."deleted_at" IS NULL AND "industry_category_hierarchies"."descendant_id" = $1 AND ("industry_categories"."id" != 1395) [["descendant_id", 1395]]

image

image

@Aiden-Xi Aiden-Xi closed this as completed Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant