Well not exactly, merely move the distinct to a sub query. A DISTINCT clause means the database server has to iterate over the returned result set and insure a single column has no to exact same values. That becomes a large task when the result set is large. However, if we added the DISTINCT clause as a subquery to the table that produces the duplicate entries (node_access), then the DISTINCT filter would filter over the least amount of results needed to produce a unique result set.

Alternately, the sub-query DISTINCT could become a "COUNT(*), nid" and GROUP BY nid which will also produce unique nid records.Though since grant_(op) is a required field, this is a less desirable tactic.

CommentFileSizeAuthor
remove-distinct.patch2.22 KBjosh waihi

Comments

Status: Needs review » Needs work

The last submitted patch, remove-distinct.patch, failed testing.

sun.core’s picture

Priority: Major » Normal
Issue tags: +Performance

I don't see the case for the major priority here. Rather a performance patch?

azol’s picture

Status: Needs work » Needs review
Issue tags: -Performance

remove-distinct.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Performance

The last submitted patch, remove-distinct.patch, failed testing.

amateescu’s picture