Commit 0c882a2
committed
Optimize various aggregate deserialization functions, take 2
f0efa5a added initReadOnlyStringInfo to allow a StringInfo to be
initialized from an existing buffer and also relaxed the requirement
that a StringInfo's buffer must be NUL terminated at data[len]. Now
that we have that, there's no need for these aggregate deserial
functions to use appendBinaryStringInfo() as that rather wastefully
palloc'd a new buffer and memcpy'd in the bytea's buffer. Instead, we can
just use the bytea's buffer and point the StringInfo directly to that
using the new initializer function.
In Amdahl's law, this speeds up the serial portion of parallel
aggregates and makes sum(numeric), avg(numeric), var_pop(numeric),
var_samp(numeric), variance(numeric), stddev_pop(numeric),
stddev_samp(numeric), stddev(numeric), array_agg(anyarray),
string_agg(text) and string_agg(bytea) scale better in parallel queries.
Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvr%3De-YOigriSHHm324a40HPqcUhSp6pWWgjz5WwegR%3DcQ%40mail.gmail.com1 parent 26f9882 commit 0c882a2
3 files changed
+28
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
726 | | - | |
727 | | - | |
| 726 | + | |
| 727 | + | |
728 | 728 | | |
729 | | - | |
730 | | - | |
731 | | - | |
| 729 | + | |
| 730 | + | |
732 | 731 | | |
733 | 732 | | |
734 | 733 | | |
| |||
815 | 814 | | |
816 | 815 | | |
817 | 816 | | |
818 | | - | |
819 | 817 | | |
820 | 818 | | |
821 | 819 | | |
| |||
1124 | 1122 | | |
1125 | 1123 | | |
1126 | 1124 | | |
1127 | | - | |
1128 | | - | |
| 1125 | + | |
| 1126 | + | |
1129 | 1127 | | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
| 1128 | + | |
| 1129 | + | |
1133 | 1130 | | |
1134 | 1131 | | |
1135 | 1132 | | |
| |||
1187 | 1184 | | |
1188 | 1185 | | |
1189 | 1186 | | |
1190 | | - | |
1191 | 1187 | | |
1192 | 1188 | | |
1193 | 1189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5190 | 5190 | | |
5191 | 5191 | | |
5192 | 5192 | | |
5193 | | - | |
5194 | | - | |
| 5193 | + | |
| 5194 | + | |
5195 | 5195 | | |
5196 | | - | |
5197 | | - | |
5198 | | - | |
| 5196 | + | |
| 5197 | + | |
5199 | 5198 | | |
5200 | 5199 | | |
5201 | 5200 | | |
| |||
5222 | 5221 | | |
5223 | 5222 | | |
5224 | 5223 | | |
5225 | | - | |
5226 | 5224 | | |
5227 | 5225 | | |
5228 | 5226 | | |
| |||
5306 | 5304 | | |
5307 | 5305 | | |
5308 | 5306 | | |
5309 | | - | |
5310 | | - | |
| 5307 | + | |
| 5308 | + | |
5311 | 5309 | | |
5312 | | - | |
5313 | | - | |
5314 | | - | |
| 5310 | + | |
| 5311 | + | |
5315 | 5312 | | |
5316 | 5313 | | |
5317 | 5314 | | |
| |||
5342 | 5339 | | |
5343 | 5340 | | |
5344 | 5341 | | |
5345 | | - | |
5346 | 5342 | | |
5347 | 5343 | | |
5348 | 5344 | | |
| |||
5677 | 5673 | | |
5678 | 5674 | | |
5679 | 5675 | | |
5680 | | - | |
5681 | | - | |
| 5676 | + | |
| 5677 | + | |
5682 | 5678 | | |
5683 | | - | |
5684 | | - | |
5685 | | - | |
| 5679 | + | |
| 5680 | + | |
5686 | 5681 | | |
5687 | 5682 | | |
5688 | 5683 | | |
| |||
5706 | 5701 | | |
5707 | 5702 | | |
5708 | 5703 | | |
5709 | | - | |
5710 | 5704 | | |
5711 | 5705 | | |
5712 | 5706 | | |
| |||
5868 | 5862 | | |
5869 | 5863 | | |
5870 | 5864 | | |
5871 | | - | |
5872 | | - | |
| 5865 | + | |
| 5866 | + | |
5873 | 5867 | | |
5874 | | - | |
5875 | | - | |
5876 | | - | |
| 5868 | + | |
| 5869 | + | |
5877 | 5870 | | |
5878 | 5871 | | |
5879 | 5872 | | |
| |||
5889 | 5882 | | |
5890 | 5883 | | |
5891 | 5884 | | |
5892 | | - | |
5893 | 5885 | | |
5894 | 5886 | | |
5895 | 5887 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5289 | 5289 | | |
5290 | 5290 | | |
5291 | 5291 | | |
5292 | | - | |
5293 | | - | |
| 5292 | + | |
| 5293 | + | |
5294 | 5294 | | |
5295 | | - | |
5296 | | - | |
5297 | | - | |
| 5295 | + | |
| 5296 | + | |
5298 | 5297 | | |
5299 | 5298 | | |
5300 | 5299 | | |
| |||
5307 | 5306 | | |
5308 | 5307 | | |
5309 | 5308 | | |
5310 | | - | |
5311 | 5309 | | |
5312 | 5310 | | |
5313 | 5311 | | |
| |||
0 commit comments