mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-25 06:48:01 -05:00
165c3d12d625424fcfffbb2684282b1bd266c6c3
PG9 doesn't like the query from _load_link_comments in comment_tree.py. thing.py will automatically filter deleted and spam items out of thing queries if no rules are specified for those columns. To get around this, some queries, including the _load_link_comments one, will specify a rule like _spam == (True, False). This rule was left in the ruleset, despite the fact that it's completely unnecessary from the SQL's standpoint. Its presence then triggered the need of a join against the thing table when only the data table was truly necessary. The query planner in PG9 doesn't like this particular query when it requires a join and will force a full table scan as a result. This patch notes the special case of _spam/_deleted == (True,False) and turns off the default filtering but removes the rules from the query. This saves some WHERE clauses and more importantly removes the need for a JOIN in queries like this one.
Description
No description provided
Languages
Python
54.4%
JavaScript
26.7%
HTML
11.3%
Less
4.5%
Shell
1%
Other
2%