path.inc query should run faster on InnoDB
David Strauss - May 19, 2008 - 22:10
| Project: | Drupal |
| Version: | 6.x-dev |
| Component: | base system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | David Strauss |
| Status: | patch (code needs review) |
Description
The COUNT query in path.inc runs fine on MyISAM because MyISAM keeps track of the total rows in each table. InnoDB must count all rows.
Fortunately, we don't need to count all of them. We just need to know if there's at least one.
| Attachment | Size |
|---|---|
| better_path_count.patch | 476 bytes |

#1
#2
Here's a D6 version.
#3
Just checked, this is "fixed" in Drupal 7 by virtue of not running such a check at all.
#4
Whoops, my later comment overwrote webchick's status change.
#5
Updated patches.
#6
Account for possibility of "" and "0" as paths.
#7
$count is no longer an accurate name for the variable. I would rename it to $has_paths with a boolean value. The ternary operator and '> 0' can be removed.
#8
Updated patches to include drumm's suggestions.
#9
Ignore those last patches. I need to handle a regression in "0" and "" path handling.
#10
I meant keep the !== FALSE, but remove the redundant ternary.
#11
@drumm Yes, I realized that. That's why I said my last post was bad.