Quantcast
Channel: FeedBunch:72746f1d36ee27cbb60245a53b05a279a371e279 commits
Viewing all articles
Browse latest Browse all 38

Performance improvement when retrieving unread entries.

$
0
0
When retrieving unread entries, we already know that all entries in the list will be unread (it is guaranteed by the queries that get them from the DB). Therefore the step of looking at entry_states table for each entry to find out its read/unread state can be safely skipped. This saves one SQL GET and instantiating an ActiveRecord object for each entry in the list. This does not apply when retrieving all entries, both read and unread. In this case we don't know each entry state beforehand, so it must be retrieved from the DB. Probably some kind of optimization could be applied here in the future, either database denormalization or eager loading of the state.

Viewing all articles
Browse latest Browse all 38

Trending Articles