forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb619852
committed
Improve COPY TO performance when server and client encodings match
This commit fixes an oversight introduced inc61a2f5, where COPY TOwould attempt to do encoding conversions even if the encodings of theclient and the server matched for multi-byte encodings. All conversionsgo through pg_any_to_server() that makes the conversion a no-op when theencodings of the client and the server match, even for multi-byteencodings.The logic was fine, but setting CopyToStateData->need_transcoding wouldcause strlen() to be called for nothing for each attribute of all therows copied, and that was showing high in some profiles (more attributesmake that easier to reach). This change improves the runtime of someworst-case COPY TO queries by 15%~ (number present at least here).This is a performance improvement, so no backpatch is done out ofcaution as this is not a regression.Reported-by: Andres FreundAnalyzed-by: Andres FreundAuthor: Michael PaquierReviewed-by: Heikki LinnakangasDiscussion:https://postgr.es/m/20240206020504.edijzczkgd25ek6z@awork3.anarazel.de1 parenta89fa00 commitb619852
1 file changed
+8
-6
lines changedLines changed: 8 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
612 | 612 |
| |
613 | 613 |
| |
614 | 614 |
| |
615 |
| - | |
616 |
| - | |
617 |
| - | |
| 615 | + | |
| 616 | + | |
618 | 617 |
| |
619 |
| - | |
620 |
| - | |
621 |
| - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
622 | 624 |
| |
623 | 625 |
| |
624 | 626 |
| |
|
0 commit comments
Comments
(0)