[wp-trac] [WordPress Trac] #17582: Problems with duplicated users
WordPress Trac
wp-trac at lists.automattic.com
Tue Jun 7 20:05:52 UTC 2011
#17582: Problems with duplicated users
--------------------------+---------------------
Reporter: scribu | Owner: ryan
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 3.2
Component: Query | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch |
--------------------------+---------------------
Comment (by Denis-de-Bernardy):
Replying to [comment:29 scribu]:
> greuben's test suggested that DISTINCT is faster.
That was because he was grouping by id. In other words it's ordered twice.
If you order by display_name, the group by/order by should be:
{{{
GROUP BY display_name, ID
ORDER BY display_name, ID
}}}
That way they'll only need to be ordered once, and the extra ID sub-
ordering will strip out the dups. Best I'm aware MySQL won't do this
automatically when using distinct, though I may be wrong (in which case it
would certainly explain why it was faster to use distinct).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17582#comment:30>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list