diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-05-06 11:01:05 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-05-06 11:01:05 -0400 |
commit | 9515299485a591b3a8f03c118d11809d01663665 (patch) | |
tree | 3ff9ffa10af83cdcfea7b954df7f3a30522bd262 /src/backend/commands/async.c | |
parent | daa9856fcea775caeb4c92580b9693858509b43b (diff) | |
download | postgresql-9515299485a591b3a8f03c118d11809d01663665.tar.gz postgresql-9515299485a591b3a8f03c118d11809d01663665.zip |
Improve handling of numeric-valued variables in pgbench.
The previous coding always stored variable values as strings, doing
conversion on-the-fly when a numeric value was needed or a number was to be
assigned. This was a bit inefficient and risked loss of precision for
floating-point values. The precision aspect had been hacked around by
printing doubles in "%.18e" format, which is ugly and has machine-dependent
results. Instead, arrange to preserve an assigned numeric value in the
original binary numeric format, converting to string only when and if
needed. When we do need to convert a double to string, convert in "%g"
format with DBL_DIG precision, which is the standard way to do it and
produces the least surprising results in most cases.
The implementation supports storing both a string value and a numeric
value for any one variable, with lazy conversion between them. I also
arranged for lazy re-sorting of the variable array when new variables are
added. That was mainly to allow a clean refactoring of putVariable()
into two levels of subroutine, but it may allow us to save a few sorts.
Discussion: <9188.1462475559@sss.pgh.pa.us>
Diffstat (limited to 'src/backend/commands/async.c')
0 files changed, 0 insertions, 0 deletions