]> granicus.if.org Git - postgresql/commit
Improve speed of timestamp/time/date output functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 7 Feb 2016 04:11:28 +0000 (23:11 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 7 Feb 2016 04:11:28 +0000 (23:11 -0500)
commitaa2387e2fd532954e88dfd8546ab894b9305123d
treec58b1331597a50ad2cfc96b4fac5a81fde34f050
parentb921aeb1676f128f2c41ddc40d3887964ea9eae9
Improve speed of timestamp/time/date output functions.

It seems that sprintf(), at least in glibc's version, is unreasonably slow
compared to hand-rolled code for printing integers.  Replacing most uses of
sprintf() in the datetime.c output functions with special-purpose code
turns out to give more than a 2X speedup in COPY of a table with a single
timestamp column; which is pretty impressive considering all the other
logic in that code path.

David Rowley and Andres Freund, reviewed by Peter Geoghegan and myself
src/backend/utils/adt/datetime.c
src/backend/utils/adt/numutils.c
src/include/utils/builtins.h