Hi,

I felt I should bring this to a discussion as I have reach a bottleneck with this issue.

I am testing this using drupal 6.8/cck 2.2/views 2.5 on a site with over 60 000 nodes. What i did is to just create a simple grid view, 20 items pager with 2 fields, node.title and user.picture, a node.post date sort and and node.Published filter.

This gives me a whopping Query execute time of ard 10133.26 ms!

Either removing node.title, node.post date sort, or node.Published filter will bring down the execute time to ard 600.00 ms, which the difference seems too great.

node.title seems to be the key issue here from a few other tests that I did. Below is a export of the view and hope that someone can test it on sites with large number of nodes and report the results here. Thanks!

$view = new view;
$view->name = 'viewtest';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'title' => array(
    'label' => 'Title',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'name' => array(
    'label' => 'Name',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_user' => 1,
    'overwrite_anonymous' => 0,
    'anonymous_text' => '',
    'exclude' => 0,
    'id' => 'name',
    'table' => 'users',
    'field' => 'name',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'picture' => array(
    'label' => 'Picture',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'exclude' => 0,
    'id' => 'picture',
    'table' => 'users',
    'field' => 'picture',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'created' => array(
    'order' => 'DESC',
    'granularity' => 'second',
    'id' => 'created',
    'table' => 'node',
    'field' => 'created',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('items_per_page', 20);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'grid');
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'viewtest');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));

Comments

dawehner’s picture

Category: feature » bug

did you onece copied the resulting sql, for example you can get the query using devel query log.

Do you have installed any node access modules?
This can cause quite a big slow performance for many nodes. PS as only short help you could use panels and use the simple cache mechanism so this hard query only have to be runned some times

dropchew’s picture

Hi dereine,

This is what i get from the above view,

SELECT node.nid AS nid, node.title AS node_title, users.name AS users_name, users.uid AS users_uid, users.picture AS users_picture, node.created AS node_created FROM node node  INNER JOIN users users ON node.uid = users.uid WHERE node.status <> 0 ORDER BY node_created DESC 

Query build time	2.33 ms
Query execute time	11657.16 ms
View render time	97.6 ms

Removing node.Published filter gives me this,

SELECT node.nid AS nid, node.title AS node_title, users.name AS users_name, users.uid AS users_uid, users.picture AS users_picture, node.created AS node_created FROM node node  INNER JOIN users users ON node.uid = users.uid ORDER BY node_created DESC 

Query build time	5.01 ms
Query execute time	87.14 ms
View render time	92.92 ms

I do not have any node access modules installed...Not too sure how to get the query from devel log.

Shai’s picture

subscribing

merlinofchaos’s picture

Status: Active » Closed (won't fix)

Seriously, what am I supposed to do about this? That's a perfectly simple query. Views can't write a query that performs better, and Views doesn't control the schema. So there's absolutely nothing Views can do here. As near as I can tell from your other bug reports, you've got a mysql install that performs like a dog. My best guess is that it's misconfigured but I'm not an expert in mysql configuration.

dropchew’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 6.x-2.5 » 6.8
Component: Code » node system
Category: bug » support

Hi merlin,

I don't think this is a bug from views either. (I did not set the status to bug report btw). Its tested on my test environment with xampp and production server (Lxadmin lighttpd) and both shows similar results. Maybe I should move this to the core issue and see if any other users have come across this. Sorry about that.

dropchew’s picture

Status: Closed (won't fix) » Active
mdupont’s picture

Status: Active » Closed (won't fix)

Still won't fix. There is not much to do from Drupal side.