欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

drupal views 太慢 分析 views 的 sql 语句 分析过程 使用 force index (field_time_value) 字段 速度变快了

views (query.inc) 的 约 930行 下面红色部分 是添加的代码
$joins = $fields = $where = $having = $orderby = $groupby = '';

    // Add all the tables to the query via joins. We assume all LEFT joins.
    foreach ($this->table_queue as $table) {
      if (is_object($table['join'])) {
        $joins .= $table['join']->join($table, $this) . "\n";
      }
    }
    //当 $_GET['q']=='listkefu' 强制使用时间索引 速度更快
    if(!empty($_GET['q']) && $_GET['q']=='listkefu'){
      $joins = str_ireplace('LEFT JOIN {content_field_time} node_data_field_time','LEFT JOIN {content_field_time} node_data_field_time force index(field_time_value)',$joins);
    }
//    var_dump("AAA");
//    $export = kprint_r($joins,TRUE);
//    print($export);
    $has_aggregate = FALSE;
    $non_aggregates = array();



普通分类: