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

How to eager load rating_caches? #55

Open
tispratik opened this issue Dec 12, 2013 · 0 comments
Open

How to eager load rating_caches? #55

tispratik opened this issue Dec 12, 2013 · 0 comments

Comments

@tispratik
Copy link

I have tried many different ways to eager load the rating caches for a users items. But can't seem to get it right. Can you please suggest?

RatingCache Load (0.3ms) SELECT "rating_caches".* FROM "rating_caches" WHERE "rating_caches"."cacheable_id" = $1 AND "rating_caches"."cacheable_type" = $2 AND "rating_caches"."dimension" IS NULL ORDER BY "rating_caches"."id" ASC LIMIT 1 [["cacheable_id", 89], ["cacheable_type", "Item"]]

(0.3ms) SELECT COUNT(*) FROM "rates" WHERE "rates"."rater_id" = $1 AND (("rates"."dimension" IS NULL AND "rates"."rateable_id" = 89 AND "rates"."rateable_type" = 'Item')) [["rater_id", 52]]

RatingCache Load (0.3ms) SELECT "rating_caches".* FROM "rating_caches" WHERE "rating_caches"."cacheable_id" = $1 AND "rating_caches"."cacheable_type" = $2 AND "rating_caches"."dimension" IS NULL ORDER BY "rating_caches"."id" ASC LIMIT 1 [["cacheable_id", 87], ["cacheable_type", "Item"]]

(0.4ms) SELECT COUNT(*) FROM "rates" WHERE "rates"."rater_id" = $1 AND (("rates"."dimension" IS NULL AND "rates"."rateable_id" = 87 AND "rates"."rateable_type" = 'Item')) [["rater_id", 52]]

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