Details

      Description

      Password extension - the extension ezx_mbpaex selects * from the table with the same name which, as we have 400k+ users and growing massively, is a large process.

      This is unnecessary. Several much better solutions are available. The attached patch adds a simple "LIMIT 1". Other possible fixes:

      • SELECT COUNT FROM ezx_mbpaex
      • SELECT COUNT FROM ezx_mbpaex where 1 = 0
      • if ( !in_array( 'ezx_mbpaex', eZDB::instance()->relationList() ) )

      Generally speaking, this kind of checking should not be done on every page request as it is in this case. No other datatype validates schema like this before registering datatype. This can be done in class functions instead (when user tries to add datatype to class) and maybe the login handler. It would make sense to abstract this to an eZDB::tableExists('...') method that we can fix/improve over time.

      Also:
      We should definitely find/use a common pattern for this check for datatypes that need extra tables. Right now every extension does its own thing. Perhaps we should not even code these checks in php, but leave it to the 'enable extension' button to find the proper share/db_schema.dba file and install it.

      Steps to reproduce
      • Enable ezmbpaex
      • Access user objects
      1. 018174_no_check_on_each_request.diff
        1 kB
        André R
      2. ezmbpaex-performance-ezp44.diff
        0.4 kB
        (inactive) Gunnstein Lye

        Activity

        Hide
        (inactive) Gunnstein Lye added a comment -

        GG says:
        Some more info: doing a "select * limit 1" might still lock the whole table - esp. on oracle where the limit is applied at fetch time, not at select time (there is no such construct in their sql) hurting performances if there are many inserts / updates in it.

        Show
        (inactive) Gunnstein Lye added a comment - GG says: Some more info: doing a "select * limit 1" might still lock the whole table - esp. on oracle where the limit is applied at fetch time, not at select time (there is no such construct in their sql) hurting performances if there are many inserts / updates in it.
        Hide
        André R added a comment - - edited

        In addition the extension should not check this on every request, see attached patch for possible alternative.
        018174_no_check_on_each_request.diff

        Show
        André R added a comment - - edited In addition the extension should not check this on every request, see attached patch for possible alternative. 018174_no_check_on_each_request.diff
        Show
        Jérôme Vieilledent added a comment - Fixed in : master ( https://github.com/ezsystems/ezmbpaex/commit/9df085b49c8f01f1ce6e014d34db94df8904561a ) stable-1.3 ( https://github.com/ezsystems/ezmbpaex/commit/5dadfa8f99e26d12b5eb5c855fef37319f4639d6 ) stable-1.2 ( https://github.com/ezsystems/ezmbpaex/commit/eeab19345dad4d5be0a1ed0b6e24710bdcfbb282 )
        Hide
        Geir Arne Waaler added a comment -

        Reported as fixed. I move it to Closed.

        Geir Arne Waaler
        eZ Documentation

        Show
        Geir Arne Waaler added a comment - Reported as fixed. I move it to Closed. Geir Arne Waaler eZ Documentation

          People

          • Assignee:
            Jérôme Vieilledent
            Reporter:
            (inactive) Gunnstein Lye
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: