Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Improve performance of views by change the base table.

Parent Feed: 

On websites with a lot of users and especially a lot of nodes a lot of queries can kill your site performance.

One central problem is the usage of node access. It's recommended to avoid it as long you can, but there might be other ways to get around some problems. Here is one specific example which is quite interesting.

The goal of the view was to show the X latest users together with it's profile picture and some additional stuff. The site used content profile so a view with the base_table "node" was used. Sadly this query was horrible slow so views caching was set to a long time(using views caching is a easy and good improvement and is highly recommended).

When the cache had to be rebuild the query was still slow. So instead of using node as base table choosing user as base table made it. This improved the query time by the factor 10, because of several reasons:

  • no node access system is used(which wasn't needed on this view)
  • less rows has to be joined

In views3 recently a patch landed which allows to disable node access on a certain view: http://drupal.org/node/621142

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web