? 931390-9.views-boolean-query-optimization.D7.patch
? dif
Index: docs/docs.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/docs/docs.php,v
retrieving revision 1.16.4.6
diff -u -p -r1.16.4.6 docs.php
--- docs/docs.php	16 Oct 2010 08:41:24 -0000	1.16.4.6
+++ docs/docs.php	31 Oct 2010 21:32:08 -0000
@@ -179,6 +179,8 @@ function hook_views_data() {
       'handler' => 'views_handler_filter_boolean_operator',
       'label' => t('Published'),
       'type' => 'yes-no',
+      // use boolean_field = 1 instead of boolean_field <> 0 in WHERE statment
+      'use_equal' => TRUE,
     ),
     'sort' => array(
       'handler' => 'views_handler_sort',
Index: handlers/views_handler_filter_boolean_operator.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/handlers/views_handler_filter_boolean_operator.inc,v
retrieving revision 1.6.4.5
diff -u -p -r1.6.4.5 views_handler_filter_boolean_operator.inc
--- handlers/views_handler_filter_boolean_operator.inc	26 Aug 2010 09:41:55 -0000	1.6.4.5
+++ handlers/views_handler_filter_boolean_operator.inc	31 Oct 2010 21:32:08 -0000
@@ -135,7 +135,6 @@ class views_handler_filter_boolean_opera
     $field = "$this->table_alias.$this->real_field";
 
     if (empty($this->value)) {
-
       if ($this->accept_null) {
         $or = db_or()
           ->condition($field, 0, '=')
@@ -147,7 +146,12 @@ class views_handler_filter_boolean_opera
       }
     }
     else {
-      $this->query->add_where($this->options['group'], $field, 0, '<>');
+      if (!empty($this->definition['use_equal'])) {
+        $this->query->add_where($this->options['group'], $field, 1, '=');
+      }
+      else {
+        $this->query->add_where($this->options['group'], $field, 0, '<>');
+      }
     }
   }
 }
Index: modules/node.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/modules/node.views.inc,v
retrieving revision 1.97.4.18
diff -u -p -r1.97.4.18 node.views.inc
--- modules/node.views.inc	14 Oct 2010 20:28:49 -0000	1.97.4.18
+++ modules/node.views.inc	31 Oct 2010 21:32:08 -0000
@@ -166,6 +166,7 @@ function node_views_data() {
       'handler' => 'views_handler_filter_boolean_operator',
       'label' => t('Published'),
       'type' => 'yes-no',
+      'use_equal' => TRUE, // Use status = 1 instead of status <> 0 in WHERE statment
     ),
     'sort' => array(
       'handler' => 'views_handler_sort',
Index: modules/node/views_handler_filter_node_status.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/modules/node/views_handler_filter_node_status.inc,v
retrieving revision 1.2.4.5
diff -u -p -r1.2.4.5 views_handler_filter_node_status.inc
--- modules/node/views_handler_filter_node_status.inc	22 Sep 2010 21:31:29 -0000	1.2.4.5
+++ modules/node/views_handler_filter_node_status.inc	31 Oct 2010 21:32:09 -0000
@@ -9,6 +9,6 @@ class views_handler_filter_node_status e
 
   function query() {
     $table = $this->ensure_my_table();
-    $this->query->add_where($this->options['group'], "$table.status <> 0 OR ($table.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0 AND ***VIEW_OWN_UNPUBLISHED_NODES*** = 1) OR ***ADMINISTER_NODES*** = 1", array(), 'formula');
+    $this->query->add_where($this->options['group'], "$table.status = 1 OR ($table.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0 AND ***VIEW_OWN_UNPUBLISHED_NODES*** = 1) OR ***ADMINISTER_NODES*** = 1", array(), 'formula');
   }
 }
