Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23462

Cache Object state Persistence class with Stash

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 5.3.2, 5.3.3, 5.4-dev
    • Component/s: Caching
    • Labels:
      None
    • Environment:

      ez 5.3.2
      CentOS release 6.5 (Final)
      PHP 5.5.14

      Description

      When using the state group limitation in the content/read policy, the number of queries will increase a lot.
      Every object will be fetched by three instead of one query. The query fetching the content left, but the two additional will fetch the state from the database.
      One is the same on every object:

      SELECT
      `ezcobj_state_group`.`default_language_id` `ezcobj_state_group_default_language_id`,
      `ezcobj_state_group`.`id` `ezcobj_state_group_id`,
      `ezcobj_state_group`.`identifier` `ezcobj_state_group_identifier`,
      `ezcobj_state_group`.`language_mask` `ezcobj_state_group_language_mask`,
      `ezcobj_state_group_language`.`description` `ezcobj_state_group_language_description`,
      `ezcobj_state_group_language`.`language_id` `ezcobj_state_group_language_language_id`,
      `ezcobj_state_group_language`.`real_language_id` `ezcobj_state_group_language_real_language_id`,
      `ezcobj_state_group_language`.`name` `ezcobj_state_group_language_name`
      FROM
      `ezcobj_state_group`
      INNER JOIN `ezcobj_state_group_language` ON `ezcobj_state_group`.`id` = `ezcobj_state_group_language`.`contentobject_state_group_id`
      LIMIT
      2147483647 OFFSET 0
      

      The other one will depend on the object:

      SELECT
      `ezcobj_state`.`default_language_id` `ezcobj_state_default_language_id`,
      `ezcobj_state`.`group_id` `ezcobj_state_group_id`,
      `ezcobj_state`.`id` `ezcobj_state_id`,
      `ezcobj_state`.`identifier` `ezcobj_state_identifier`,
      `ezcobj_state`.`language_mask` `ezcobj_state_language_mask`,
      `ezcobj_state`.`priority` `ezcobj_state_priority`,
      `ezcobj_state_language`.`description` `ezcobj_state_language_description`,
      `ezcobj_state_language`.`language_id` `ezcobj_state_language_language_id`,
      `ezcobj_state_language`.`name` `ezcobj_state_language_name`
      FROM
      `ezcobj_state`
      INNER JOIN `ezcobj_state_language` ON `ezcobj_state`.`id` = `ezcobj_state_language`.`contentobject_state_id`
      INNER JOIN `ezcobj_state_link` ON `ezcobj_state`.`id` = `ezcobj_state_link`.`contentobject_state_id`
      WHERE
      (
      `ezcobj_state`.`group_id` = : placeholder1
      AND `ezcobj_state_link`.`contentobject_id` = : placeholder2
      )
      

      There should be a way to cache these two queries. Stash seems not to be involved as cache.

      One bad effect is that currently it is not possible to reduce these queries. With the default content/read policy limited to the Standard section, the page will be cached fine and have only two queries left at the second page request. With the object state limitation in place it will keep performing over 140 queries (with only ~20 objects in place) even the second, cached call.

      Steps to reproduce:

      1. Create a state group with 2 states inside.
      2. Assign to objects.
      3. Create a read policy with state limitation.
      4. Look at the generate sql queries

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              nuno.oliveira-obsolete@ez.no Nuno Oliveira (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: