Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4577

RelDigestWriter#done has performance issue when node's inputs is large

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • None
    • None
    • core
    • None

    Description

      Example like that: insert xxx VALUES (1, 'one'), (2, 'two'), (3, 'three')...(10000, 'ten thousand');

      It generates a Union node with 10000 inputs, and the performance is poor, here's the profile:

       

      A point that affects performance is the array copy of StringBuilder, current we just new StringBuilder with default capacity, my proposal is to consider the node's input size, like that(we can discuss the strategy):

      org.apache.calcite.rel.AbstractRelNode.RelDigestWriter#done

            StringBuilder sb = new StringBuilder((values.size() + 1) * 16);

      It's about 20% performance improvement and mem is more smooth.
       

      Attachments

        1. image-2021-04-11-16-53-35-466.png
          187 kB
          Jiatao Tao
        2. image-2021-04-11-16-53-58-757.png
          89 kB
          Jiatao Tao

        Activity

          People

            Unassigned Unassigned
            Aron.tao Jiatao Tao
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: