Project

General

Profile

Actions

Bug #67837

closed

Extbase performs unnecessary count queries

Added by Mathias Brodala over 9 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Category:
Extbase
Target version:
Start date:
2015-06-30
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Quoting from https://jira.neos.io/browse/FLOW-326:

QueryResult::count() always execute a COUNT query, even if the results have been fetched or counted already.
This is especially an issue because we make use of this method a lot under the hood.
For example this (simplified but realistic) Fluid snippet:

<f:if condition="{products}">
  <h1>{products -> f:count()} products:</h1>
  <f:widget.paginate objects="{products}" as="paginatedProducts">
    <ul>
      <f:for each="{paginatedProducts}" as="product" iteration="iteration">
        <li>{product.name}</li>
      </f:for>
    </ul>
  </f:widget.paginate>
</f:if>

will execute the same SELECT COUNT(DISTINCT ... query four times.
And those counts can be very costly especially with complex queries or many rows in a INNODB table.

Actions #1

Updated by Gerrit Code Review over 9 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40750

Actions #2

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40750

Actions #3

Updated by Gerrit Code Review over 9 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40750

Actions #4

Updated by Gerrit Code Review over 9 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40778

Actions #5

Updated by Mathias Brodala over 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 50 to 100
Actions #6

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF