Problem/Motivation

Range in select query allows getting multiple rows when only one is needed.

->range($this->maxRows, $this->maxRows + 1) in DatabaseBackend::garbageCollection()

As result, it can cause performance problems when database_cache_max_rows is high.

CommentFileSizeAuthor
#3 3351113-2.patch628 bytesa.milkovsky

Comments

mostepaniukvm created an issue. See original summary.

mostepaniukvm’s picture

Issue summary: View changes
a.milkovsky’s picture

Status: Active » Needs review
StatusFileSize
new628 bytes

This path fixes the typo in query.

daffie’s picture

Status: Needs review » Reviewed & tested by the community

The second parameter for the method range() for a select query is the number of rows that the query should return. The query also does a fetchField() which only needs a single row from the query. Therefor the code change is the correct one.
I do not see how we can test change. Without the change is the method garbageCollection() not failing, it is just a bit slower.
For me it is RTBC.

  • catch committed 80d83864 on 10.0.x
    Issue #3351113 by a.milkovsky, mostepaniukvm, daffie: Not optimal query...

  • catch committed 5a53a638 on 10.1.x
    Issue #3351113 by a.milkovsky, mostepaniukvm, daffie: Not optimal query...

  • catch committed 424a6405 on 9.5.x
    Issue #3351113 by a.milkovsky, mostepaniukvm, daffie: Not optimal query...
catch’s picture

Version: 10.1.x-dev » 9.5.x-dev
Status: Reviewed & tested by the community » Fixed

Good find. Committed/pushed to 10.1.x, cherry-picked to 10.0.x and 9.5.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.