Make WordPress Core

Changeset 4450


Ignore:
Timestamp:
11/07/2006 11:43:59 PM (18 years ago)
Author:
ryan
Message:

GROUP BY is hella faster than DISTINCT.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r4426 r4450  
    584584        $join = '';
    585585        $search = '';
     586        $groupby = '';
    586587
    587588        if ( !isset($q['post_type']) )
     
    802803            }
    803804            $whichcat = $in_cats . $out_cats;
    804             $distinct = 'DISTINCT';
     805            $groupby = "{$wpdb->posts}.ID";
    805806        }
    806807
    807808        // Category stuff for nice URLs
    808 
    809         global $cache_categories;
    810809        if ('' != $q['category_name']) {
    811810            $reqcat = get_category_by_path($q['category_name']);
     
    837836            $whichcat = substr($whichcat, 0, -2);
    838837            $whichcat .= ")";
    839             $distinct = 'DISTINCT';
     838            $groupby = "{$wpdb->posts}.ID";
    840839        }
    841840
     
    976975        // manipulate paging queries should use these hooks.
    977976        $where = apply_filters('posts_where_paged', $where);
    978         $groupby = '';
    979977        $groupby = apply_filters('posts_groupby', $groupby);
    980978        if ( ! empty($groupby) )
Note: See TracChangeset for help on using the changeset viewer.