Skip to content

Panda and Tiger Level completed - #23

Open
buk wants to merge 4 commits into
RubyoffRails:masterfrom
buk:master
Open

Panda and Tiger Level completed#23
buk wants to merge 4 commits into
RubyoffRails:masterfrom
buk:master

Conversation

@buk

@bukbuk commented Aug 12, 2013

Copy link
Copy Markdown

Hi Jeff,

thank you for reviewing and commenting my stuff!

Comment threadwatchman.rb

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will actually execute many queries (1 query for each show, for each network). It's what's called a n+1 query, and a frequent performance problem.

Instead, you could:

Show.where(day_of_week: weekday).eachdo |show|
putsshowend

After all, we don't need to group by the network at all here.

@jwo

jwo commented Aug 12, 2013

Copy link
Copy Markdown
Member

Things look good!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@buk@jwo