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.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | better_path_count_5.patch | 1.01 KB | david strauss |
| #8 | better_path_count_6.patch | 1.19 KB | david strauss |
| #6 | better_path_count_5.patch | 493 bytes | david strauss |
| #6 | better_path_count_6.patch | 493 bytes | david strauss |
| #5 | better_path_count_5.patch | 481 bytes | david strauss |
Comments
Comment #1
webchickComment #2
david straussHere's a D6 version.
Comment #3
david straussJust checked, this is "fixed" in Drupal 7 by virtue of not running such a check at all.
Comment #4
david straussWhoops, my later comment overwrote webchick's status change.
Comment #5
david straussUpdated patches.
Comment #6
david straussAccount for possibility of "" and "0" as paths.
Comment #7
drumm$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.
Comment #8
david straussUpdated patches to include drumm's suggestions.
Comment #9
david straussIgnore those last patches. I need to handle a regression in "0" and "" path handling.
Comment #10
drummI meant keep the !== FALSE, but remove the redundant ternary.
Comment #11
david strauss@drumm Yes, I realized that. That's why I said my last post was bad.
Comment #12
dave reidDuplicate of #196862: COUNT(*) is an expensive query in InnoDB.