Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-11389

Oracle improvement (ancestor)

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.6.0-HF14
    • Fix Version/s: 5.6.0-HF15, 5.7.1
    • Component/s: Core VCS
    • Environment:
      Nuxeo 5.6 HF14 on windows 7, database oracle 11.2.0.1 on windows server 2008 R2,

      Description

      Using nuxeo 5.6 HF14 with pathOptimization in default-repository-config :
      <!-- pathOptimizations after hot fix : https://jira.nuxeo.com/browse/NXP-10210 -->
      <pathOptimizations enabled="true" version="2" />

      The current function : FUNCTION NX_ANCESTORS(ids NX_STRING_TABLE) does a table acces full on ancestors

      1st try for optimization to avoid full table scan

      /* Avoid full table scan and replace with full index scan */
      FUNCTION NX_ANCESTORS(ids NX_STRING_TABLE)
      RETURN NX_STRING_TABLE PIPELINED IS
      BEGIN
      FOR r in (SELECT /*+ INDEX(ancestors) */ DISTINCT(ancestor) AS ancestor FROM ancestors WHERE hierarchy_id MEMBER OF ids) LOOP
      PIPE ROW(r.ancestor);
      END LOOP;
      END;

      Final optimization to avoid index full scan

      /Replace MEMBER OF by IN (and cast) /
      FUNCTION NX_ANCESTORS(ids NX_STRING_TABLE)
      RETURN NX_STRING_TABLE PIPELINED IS
      BEGIN
      FOR r in (SELECT DISTINCT(ancestor) AS ancestor FROM ancestors WHERE hierarchy_id IN (SELECT column_value FROM TABLE(CAST(ids AS NX_STRING_TABLE)))) LOOP
      PIPE ROW(r.ancestor);
      END LOOP;
      END;

      What do you think about this ? Is it the good way ?

      Documentation : http://www.oracle-developer.net/display.php?id=301

      (Sorry for bad english i'm french)

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: