Skip to content

Performance problem & memory leak in Mage_Index_Model_Process #123

Closed
@tmotyl

Description

@tmotyl

around line 205 of Mage_Index_Model_Process::reindexAll() there is code like this:

 $unprocessedEvents = $eventResource->getUnprocessedEvents($this);
            if ($this->getMode() == self::MODE_MANUAL && (count($unprocessedEvents) > 0)) {
                $this->_getResource()->updateStatus($this, self::STATUS_REQUIRE_REINDEX);

similar code is also around line 233 in the same file

which means that the whole collection of index/event for given process and status is fetched, just to call "count()" to check if records existis in db...

the second problem is that this query and count() are executed even if process is in MODE_MANUAL -> the if statement for mode should be checked before executing query

Magento should make a query which returns 0 or 1 if records are still there like this
SELECT IF(COUNT() > 0, 1, 0) FROM ... WHERE ...
or
SELECT count(
) FROM (SELECT 1 FROM ...WHERE .... LIMIT 1)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions