Skip to content
Snippets Groups Projects
  1. Feb 07, 2006
    • Bruce Momjian's avatar
      I think that NUMERIC datatype has a problem in the performance that · e7a9ccdb
      Bruce Momjian authored
      the format on Tuple(Numeric) and the format to calculate(NumericVar)
      are different. I understood that to reduce I/O. However, when many
      comparisons or calculations of NUMERIC are executed, the conversion
      of Numeric and NumericVar becomes a bottleneck.
      
      It is profile result when "create index on NUMERIC column" is executed:
      
        %   cumulative   self              self     total
       time   seconds   seconds    calls   s/call   s/call  name
       17.61     10.27    10.27 34542006     0.00     0.00  cmp_numerics
       11.90     17.21     6.94 34542006     0.00     0.00  comparetup_index
        7.42     21.54     4.33 71102587     0.00     0.00  AllocSetAlloc
        7.02     25.64     4.09 69084012     0.00     0.00  set_var_from_num
        4.87     28.48     2.84 69084012     0.00     0.00  alloc_var
        4.79     31.27     2.79 142205745     0.00     0.00  AllocSetFreeIndex
        4.55     33.92     2.65 34542004     0.00     0.00  cmp_abs
        4.07     36.30     2.38 71101189     0.00     0.00  AllocSetFree
        3.83     38.53     2.23 69084012     0.00     0.00  free_var
      
      The create index command executes many comparisons of Numeric values.
      Functions other than comparetup_index spent a lot of cycles for
      conversion from Numeric to NumericVar.
      
      An attached patch enables the comparison of Numeric values without
      executing conversion to NumericVar. The execution time of that SQL
      becomes half.
      
      o Test SQL (index_test table has 1,000,000 tuples)
       create index index_test_idx on index_test(num_col);
      
      o Test results (executed the test five times)
      (1)PentiumIII
       original: 39.789s  36.823s  36.737s  37.752s  37.019s
       patched : 18.560s  19.103s  18.830s  18.408s  18.853s
        4.07     36.30     2.38 71101189     0.00     0.00  AllocSetFree
        3.83     38.53     2.23 69084012     0.00     0.00  free_var
      
      The create index command executes many comparisons of Numeric values.
      Functions other than comparetup_index spent a lot of cycles for
      conversion from Numeric to NumericVar.
      
      An attached patch enables the comparison of Numeric values without
      executing conversion to NumericVar. The execution time of that SQL
      becomes half.
      
      o Test SQL (index_test table has 1,000,000 tuples)
       create index index_test_idx on index_test(num_col);
      
      o Test results (executed the test five times)
      (1)PentiumIII
       original: 39.789s  36.823s  36.737s  37.752s  37.019s
       patched : 18.560s  19.103s  18.830s  18.408s  18.853s
      
      (2)Pentium4
       original: 16.349s  14.997s  12.979s  13.169s  12.955s
       patched :  7.005s   6.594s   6.770s   6.740s   6.828s
      
      (3)Itanium2
       original: 15.392s  15.447s  15.350s  15.370s  15.417s
       patched :  7.413s   7.330s   7.334s   7.339s   7.339s
      
      (4)Ultra Sparc
       original: 64.435s  59.336s  59.332s  58.455s  59.781s
       patched : 28.630s  28.666s  28.983s  28.744s  28.595s
      
      Atsushi Ogawa
      e7a9ccdb
  2. Jan 25, 2006
  3. Nov 22, 2005
  4. Nov 17, 2005
    • Tom Lane's avatar
      Make SQL arrays support null elements. This commit fixes the core array · cecb6075
      Tom Lane authored
      functionality, but I still need to make another pass looking at places
      that incidentally use arrays (such as ACL manipulation) to make sure they
      are null-safe.  Contrib needs work too.
      I have not changed the behaviors that are still under discussion about
      array comparison and what to do with lower bounds.
      cecb6075
  5. Oct 15, 2005
  6. Jul 10, 2005
    • Tom Lane's avatar
      Change typreceive function API so that receive functions get the same · d78397d3
      Tom Lane authored
      optional arguments as text input functions, ie, typioparam OID and
      atttypmod.  Make all the datatypes that use typmod enforce it the same
      way in typreceive as they do in typinput.  This fixes a problem with
      failure to enforce length restrictions during COPY FROM BINARY.
      d78397d3
  7. Jun 04, 2005
  8. Apr 07, 2005
    • Neil Conway's avatar
      Apply the "nodeAgg" optimization to more of the builtin transition · be2f825d
      Neil Conway authored
      functions. This patch optimizes int2_sum(), int4_sum(), float4_accum()
      and float8_accum() to avoid needing to copy the transition function's
      state for each input tuple of the aggregate. In an extreme case
      (e.g. SELECT sum(int2_col) FROM table where table has a single column),
      it improves performance by about 20%. For more complex queries or tables
      with wider rows, the relative performance improvement will not be as
      significant.
      be2f825d
  9. Apr 05, 2005
    • Neil Conway's avatar
      This patch changes int2_avg_accum() and int4_avg_accum() use the nodeAgg · 51b2f8ba
      Neil Conway authored
      performance hack Tom introduced recently. This means we can avoid
      copying the transition array for each input tuple if these functions
      are invoked as aggregate transition functions.
      
      To test the performance improvement, I created a 1 million row table
      with a single int4 column. Without the patch, SELECT avg(col) FROM
      table took about 4.2 seconds (after the data was cached); with the
      patch, it took about 3.2 seconds. Naturally, the performance
      improvement for a less trivial query (or a table with wider rows)
      would be relatively smaller.
      51b2f8ba
  10. Jan 01, 2005
  11. Oct 04, 2004
    • Tom Lane's avatar
      Detect overflow in integer arithmetic operators (integer, smallint, and · 4171bb86
      Tom Lane authored
      bigint variants).  Clean up some inconsistencies in error message wording.
      Fix scanint8 to allow trailing whitespace in INT64_MIN case.  Update
      int8-exp-three-digits.out, which seems to have been ignored by the last
      couple of people to modify the int8 regression test, and remove
      int8-exp-three-digits-win32.out which is thereby exposed as redundant.
      4171bb86
  12. Aug 30, 2004
  13. Aug 29, 2004
  14. May 19, 2004
  15. May 17, 2004
  16. May 14, 2004
    • Neil Conway's avatar
      Implement the width_bucket() function, per SQL2003. This commit only adds · 0079547b
      Neil Conway authored
      a variant of the function for the 'numeric' datatype; it would be possible
      to add additional variants for other datatypes, but I haven't done so yet.
      
      This commit includes regression tests and minimal documentation; if we
      want developers to actually use this function in applications, we'll
      probably need to document what it does more fully.
      0079547b
  17. May 07, 2004
    • Tom Lane's avatar
      Solve the 'Turkish problem' with undesirable locale behavior for case · 0bd61548
      Tom Lane authored
      conversion of basic ASCII letters.  Remove all uses of strcasecmp and
      strncasecmp in favor of new functions pg_strcasecmp and pg_strncasecmp;
      remove most but not all direct uses of toupper and tolower in favor of
      pg_toupper and pg_tolower.  These functions use the same notions of
      case folding already developed for identifier case conversion.  I left
      the straight locale-based folding in place for situations where we are
      just manipulating user data and not trying to match it to built-in
      strings --- for example, the SQL upper() function is still locale
      dependent.  Perhaps this will prove not to be what's wanted, but at
      the moment we can initdb and pass regression tests in Turkish locale.
      0bd61548
  18. Mar 15, 2004
  19. Feb 04, 2004
  20. Dec 02, 2003
  21. Dec 01, 2003
    • Bruce Momjian's avatar
      Attached is a patch implementing factorial(), returning numeric. Points · 04a4821a
      Bruce Momjian authored
      to note:
      
      1) arttype is numeric. I thought this was the best way of allowing
      arbitarily large factorials, even though factorial(2^63) is a large
      number. Happy to change to integers if this is overkill.
      2) since we're accepting numeric arguments, the patch tests for floats.
      If a numeric is passed with non-zero decimal portion, an error is raised
      since (from memory) they are undefined.
      
      Gavin Sherry
      04a4821a
  22. Nov 29, 2003
    • PostgreSQL Daemon's avatar
      · 969685ad
      PostgreSQL Daemon authored
      $Header: -> $PostgreSQL Changes ...
      969685ad
  23. Sep 29, 2003
  24. Sep 25, 2003
  25. Aug 04, 2003
  26. Jul 30, 2003
    • Tom Lane's avatar
      Fix numeric_smaller, numeric_larger, float4smaller, float4larger, · 4b1c6695
      Tom Lane authored
      float8smaller, float8larger (and thereby the MIN/MAX aggregates on these
      datatypes) to agree with the datatypes' comparison operations as
      regards NaN handling.  In all these datatypes, NaN is arbitrarily
      considered larger than any normal value ... but MIN/MAX had not gotten
      the word.  Per recent discussion on pgsql-sql.
      4b1c6695
  27. Jul 27, 2003
  28. Jul 03, 2003
  29. May 13, 2003
  30. Apr 21, 2003
  31. Mar 21, 2003
  32. Mar 14, 2003
  33. Mar 11, 2003
    • Tom Lane's avatar
      Add explicit tests for division by zero to all user-accessible integer · 31e69ccb
      Tom Lane authored
      division and modulo functions, to avoid problems on OS X (which fails to
      trap 0 divide at all) and Windows (which traps it in some bizarre
      nonstandard fashion).  Standardize on 'division by zero' as the one true
      spelling of this error message.  Add regression tests as suggested by
      Neil Conway.
      31e69ccb
  34. Oct 19, 2002
  35. Oct 02, 2002
  36. Sep 18, 2002
    • Tom Lane's avatar
      Extend pg_cast castimplicit column to a three-way value; this allows us · b26dfb95
      Tom Lane authored
      to be flexible about assignment casts without introducing ambiguity in
      operator/function resolution.  Introduce a well-defined promotion hierarchy
      for numeric datatypes (int2->int4->int8->numeric->float4->float8).
      Change make_const to initially label numeric literals as int4, int8, or
      numeric (never float8 anymore).
      Explicitly mark Func and RelabelType nodes to indicate whether they came
      from a function call, explicit cast, or implicit cast; use this to do
      reverse-listing more accurately and without so many heuristics.
      Explicit casts to char, varchar, bit, varbit will truncate or pad without
      raising an error (the pre-7.2 behavior), while assigning to a column without
      any explicit cast will still raise an error for wrong-length data like 7.3.
      This more nearly follows the SQL spec than 7.2 behavior (we should be
      reporting a 'completion condition' in the explicit-cast cases, but we have
      no mechanism for that, so just do silent truncation).
      Fix some problems with enforcement of typmod for array elements;
      it didn't work at all in 'UPDATE ... SET array[n] = foo', for example.
      Provide a generalized array_length_coerce() function to replace the
      specialized per-array-type functions that used to be needed (and were
      missing for NUMERIC as well as all the datetime types).
      Add missing conversions int8<->float4, text<->numeric, oid<->int8.
      initdb forced.
      b26dfb95
  37. Sep 04, 2002
  38. Sep 02, 2002
Loading