Review main Merged

27554[BUGFIX] Break out of foreach if there're no rows in table

Stefan Froemken CR +2 V +2 Easy +10 −1 updated 03/04/14, 16:13

Commit message

Instead of using a slow COUNT on huge tables, we add an
additional query here, which tries to get the first
found record in oder to test if records exists
or not. This new query is extremely fast, because it
uses indexes. It only needs one huge table
like sys_log in your database to see a performance
boost in BE list module.

Review

  • Code review CR +2
    • Markus Klein +2
    • Georg Ringer +1
    • Oliver Klee +1
  • Verified V +2
    • Markus Klein +2
    • Georg Ringer +1

Issues 1

Files 1

Review log 32

Show 7 earlier messages
  1. Stefan Froemken uploaded patch set 2 02/11/14, 18:13

  2. Stefan Froemken commented on patch set 2 V -1 CR -1 02/11/14, 18:14

    Sorry...Committed to wrong ticket
  3. Stefan Froemken abandoned the change 02/11/14, 18:14

    Committed to wrong ticket
  4. Mr. Jenkins commented on patch set 1 02/11/14, 18:26

  5. Mr. Jenkins commented on patch set 2 02/11/14, 18:39

  6. Stefan Froemken restored the change 02/12/14, 08:10

    Hmmm...seems to be the same patch for two different issues.
  7. Steffen Ritter commented on patch set 2 CR -2 02/19/14, 09:16

    1. wrong issue in commit message 2. the slow query is not prevented - there's just an additional query
  1. Stefan Froemken uploaded patch set 3 02/20/14, 08:05

  2. Stefan Froemken uploaded patch set 4 02/20/14, 08:08

  3. Mr. Jenkins commented on patch set 3 02/20/14, 08:21

  4. Mr. Jenkins commented on patch set 4 02/20/14, 08:46

  5. Steffen Ritter voted on patch set 4 CR 0 02/21/14, 07:52

  6. Oliver Klee commented on patch set 4 02/21/14, 19:52

    Break -> Break out of We're not actually breaking anything here ... ;-)
  7. Oliver Klee commented on patch set 4 02/21/14, 19:53

    Reply

    ("Break" would mean "kaputtmachen" here.)
  8. Dmitry Dulepov commented on patch set 4 02/28/14, 13:11

    Looks like we may have an unnecessary db operation here. See inline comments.

    AbstractDatabaseRecordList.php:412

    These two empty strings are not needed.

    AbstractDatabaseRecordList.php:415

    Here we are if both $firstRow is FALSE *and* $this->table is false. So the database select above will be useless if $this->table is false. Since it is much easier to check for $this->table, the select call should be inside such check to avoid unnecessary db operation. Do I miss something here?
  9. Stefan Froemken commented on patch set 4 02/28/14, 13:20

    AbstractDatabaseRecordList.php:415 Reply

    Very good hint. Thank you Dmitry. I will provide a new patch this evening. See you soon.
  10. Stefan Froemken uploaded patch set 5 03/03/14, 07:21

  11. Mr. Jenkins commented on patch set 5 03/03/14, 07:34

  12. Markus Klein voted on patch set 5 CR +1 03/03/14, 10:24

  13. Oliver Klee commented on patch set 5 03/03/14, 10:37

    AbstractDatabaseRecordList.php:419

    We have three ifs here: 1. if !$this->table 2. if $this->table 3. else If I see this correctly, 1 and 3 can be merged into one, and 2 can be made an "else" case of 1 (and then switched around so we don't have the negation anymore).
  14. Stefan Froemken uploaded patch set 6 03/03/14, 12:23

  15. Mr. Jenkins commented on patch set 6 03/03/14, 12:37

  16. Oliver Klee voted on patch set 6 CR +1 03/03/14, 13:24

  17. Markus Klein voted on patch set 6 CR +1 03/03/14, 15:31

  18. Markus Klein commented on patch set 6 03/03/14, 15:32

    ... if records exist.
  19. Markus Klein commented on patch set 6 CR 0 03/03/14, 15:33

    Maybe we should change the text here as well. We're not removing any stmt with COUNT here.
  20. Stefan Froemken uploaded patch set 7 03/04/14, 06:46

  21. Georg Ringer voted on patch set 7 V +1 CR +1 03/04/14, 06:52

  22. Mr. Jenkins commented on patch set 7 03/04/14, 06:59

  23. Oliver Klee voted on patch set 7 CR +1 03/04/14, 08:24

  24. Markus Klein voted on patch set 7 V +2 CR +2 03/04/14, 16:13

  25. Markus Klein merged patch set 8 03/04/14, 16:13