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

Query per event slows down page load #40

Open
Jwashton opened this issue Dec 7, 2014 · 1 comment
Open

Query per event slows down page load #40

Jwashton opened this issue Dec 7, 2014 · 1 comment

Comments

@Jwashton
Copy link
Collaborator

Jwashton commented Dec 7, 2014

I have one timeline imported from Twitter, 2642 tweets from one user in the last year. When I try to select the timeline, or refresh the page with it already selected, I get a 6.5 second wait. Looking at the server log, I see one query being made for each event, like so:

SELECT "timelines".* FROM "timelines" INNER JOIN "events_timelines" ON "timelines"."id" = "events_timelines"."timeline_id" WHERE "events_timelines"."event_id" = $1  [["event_id", 4771]]

Is query one that we can optimize, and is it one that we even need?

@isaachermens
Copy link
Collaborator

What we're seeing is the effects of serializing the .events association/collection proxy. It's currently lazily-loaded, so it must hit the database for each event. I've spent a little time looking at ways to load the collection eagerly, but they seem to cause worse problems.

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

2 participants