Skip to content
Snippets Groups Projects
Select Git revision
  • benchmark-tools
  • postgres-lambda
  • master default
  • REL9_4_25
  • REL9_5_20
  • REL9_6_16
  • REL_10_11
  • REL_11_6
  • REL_12_1
  • REL_12_0
  • REL_12_RC1
  • REL_12_BETA4
  • REL9_4_24
  • REL9_5_19
  • REL9_6_15
  • REL_10_10
  • REL_11_5
  • REL_12_BETA3
  • REL9_4_23
  • REL9_5_18
  • REL9_6_14
  • REL_10_9
  • REL_11_4
23 results

nodeSubqueryscan.c

Blame
    • Tom Lane's avatar
      1dc5ebc9
      Support "expanded" objects, particularly arrays, for better performance. · 1dc5ebc9
      Tom Lane authored
      This patch introduces the ability for complex datatypes to have an
      in-memory representation that is different from their on-disk format.
      On-disk formats are typically optimized for minimal size, and in any case
      they can't contain pointers, so they are often not well-suited for
      computation.  Now a datatype can invent an "expanded" in-memory format
      that is better suited for its operations, and then pass that around among
      the C functions that operate on the datatype.  There are also provisions
      (rudimentary as yet) to allow an expanded object to be modified in-place
      under suitable conditions, so that operations like assignment to an element
      of an array need not involve copying the entire array.
      
      The initial application for this feature is arrays, but it is not hard
      to foresee using it for other container types like JSON, XML and hstore.
      I have hopes that it will be useful to PostGIS as well.
      
      In this initial implementation, a few heuristics have been hard-wired
      into plpgsql to improve performance for arrays that are stored in
      plpgsql variables.  We would like to generalize those hacks so that
      other datatypes can obtain similar improvements, but figuring out some
      appropriate APIs is left as a task for future work.  (The heuristics
      themselves are probably not optimal yet, either, as they sometimes
      force expansion of arrays that would be better left alone.)
      
      Preliminary performance testing shows impressive speed gains for plpgsql
      functions that do element-by-element access or update of large arrays.
      There are other cases that get a little slower, as a result of added array
      format conversions; but we can hope to improve anything that's annoyingly
      bad.  In any case most applications should see a net win.
      
      Tom Lane, reviewed by Andres Freund
      1dc5ebc9
      History
      Support "expanded" objects, particularly arrays, for better performance.
      Tom Lane authored
      This patch introduces the ability for complex datatypes to have an
      in-memory representation that is different from their on-disk format.
      On-disk formats are typically optimized for minimal size, and in any case
      they can't contain pointers, so they are often not well-suited for
      computation.  Now a datatype can invent an "expanded" in-memory format
      that is better suited for its operations, and then pass that around among
      the C functions that operate on the datatype.  There are also provisions
      (rudimentary as yet) to allow an expanded object to be modified in-place
      under suitable conditions, so that operations like assignment to an element
      of an array need not involve copying the entire array.
      
      The initial application for this feature is arrays, but it is not hard
      to foresee using it for other container types like JSON, XML and hstore.
      I have hopes that it will be useful to PostGIS as well.
      
      In this initial implementation, a few heuristics have been hard-wired
      into plpgsql to improve performance for arrays that are stored in
      plpgsql variables.  We would like to generalize those hacks so that
      other datatypes can obtain similar improvements, but figuring out some
      appropriate APIs is left as a task for future work.  (The heuristics
      themselves are probably not optimal yet, either, as they sometimes
      force expansion of arrays that would be better left alone.)
      
      Preliminary performance testing shows impressive speed gains for plpgsql
      functions that do element-by-element access or update of large arrays.
      There are other cases that get a little slower, as a result of added array
      format conversions; but we can hope to improve anything that's annoyingly
      bad.  In any case most applications should see a net win.
      
      Tom Lane, reviewed by Andres Freund