refactor buffer handling for DB puts

+ improves write-ops/sec
+ improves memory usage when inserting large values