[wp-trac] Re: [WordPress Trac] #7415: "using filesort" in default install

WordPress Trac wp-trac at lists.automattic.com
Wed Jan 28 08:13:28 GMT 2009


#7415: "using filesort" in default install
------------------------------------------------------------+---------------
 Reporter:  dbuser123                                       |        Owner:  anonymous
     Type:  defect (bug)                                    |       Status:  new      
 Priority:  high                                            |    Milestone:  2.8      
Component:  Optimization                                    |      Version:  2.7      
 Severity:  major                                           |   Resolution:           
 Keywords:  database, optimization, slow queries, filesort  |  
------------------------------------------------------------+---------------
Comment (by Denis-de-Bernardy):

 Replying to [comment:23 mrmist]:
 > Replying to [comment:21 Denis-de-Bernardy]:
 > > Err.. silly pasting. This even:
 > >
 > > {{{
 > > SELECT COUNT($distinct $wpdb->posts.ID) FROM $wpdb->posts $join WHERE
 1=1 $where $groupby
 > > }}}
 >
 > posts.ID is an autoinc, so it's always unique.  $distinct is
 superfluous.

 of course not. suppose this results in two rows per id:

 select t1.id natural join

 then this will return one row per id:

 select distinct t1.id natural join t2

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7415#comment:26>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list