Download & Extend

path.inc query should run faster on InnoDB

Project:Drupal core
Version:6.x-dev
Component:base system
Category:bug report
Priority:normal
Assigned:David Strauss
Status:closed (duplicate)

Issue Summary

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.

AttachmentSizeStatusTest resultOperations
better_path_count.patch476 bytesIgnored: Check issue status.NoneNone

Comments

#1

Status:active» needs review

#2

Status:needs review» active

Here's a D6 version.

AttachmentSizeStatusTest resultOperations
better_path_count_6.patch476 bytesIgnored: Check issue status.NoneNone

#3

Just checked, this is "fixed" in Drupal 7 by virtue of not running such a check at all.

#4

Status:active» needs review

Whoops, my later comment overwrote webchick's status change.

#5

Updated patches.

AttachmentSizeStatusTest resultOperations
better_path_count_5.patch481 bytesIgnored: Check issue status.NoneNone
better_path_count_6.patch481 bytesIgnored: Check issue status.NoneNone

#6

Account for possibility of "" and "0" as paths.

AttachmentSizeStatusTest resultOperations
better_path_count_5.patch493 bytesIgnored: Check issue status.NoneNone
better_path_count_6.patch493 bytesIgnored: Check issue status.NoneNone

#7

Version:5.7» 6.x-dev
Status:needs review» needs work

$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

Status:needs work» needs review

Updated patches to include drumm's suggestions.

AttachmentSizeStatusTest resultOperations
better_path_count_5.patch1.01 KBIgnored: Check issue status.NoneNone
better_path_count_6.patch1.19 KBIgnored: Check issue status.NoneNone

#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.

#12

Status:needs review» closed (duplicate)

Duplicate of #196862: COUNT(*) is an expensive query in InnoDB.

nobody click here