forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit99c7541
committed
Fix performance regression in tuplesort specializations
6974924 added 3 new qsort specialization functions aimed to improve theperformance of sorting many of the common pass-by-value data types whenthey're the leading or only sort key.Unfortunately, that has caused a performance regression when sortingdatasets where many of the values being compared were equal. What washappening here was that we were falling back to the standard sortcomparison function to handle tiebreaks. When the two given Datumscompared equally we would incur both the overhead of an indirect functioncall to the standard comparer to perform the tiebreak and also thestandard comparer function would go and compare the leading key needlesslyall over again.Here improve the situation in the 3 new comparison functions. We nowreturn 0 directly when the two Datums compare equally and we're performinga 1-key sort.Here we don't do anything to help the multi-key sort case where theleading key uses one of the sort specializations functions. On testingthis case, even when the leading key's values are all equal, thereappeared to be no performance regression. Let's leave it up to futurework to optimize that case so that the tiebreak function no longerre-compares the leading key over again.Another possible fix for this would have been to add 3 additional sortspecialization functions to handle single-key sorts for thesepass-by-value types. The reason we didn't do that here is that we maydeem some other sort specialization to be more useful than single-keysorts. It may be impractical to have sort specialization functions forevery single combination of what may be useful and it was already decidedthat further analysis into which ones are the most useful would be delayeduntil the v16 cycle. Let's not let this regression force our hand intotrying to make that decision for v15.Author: David RowleyReviewed-by: John NaylorDiscussion:https://postgr.es/m/CA+hUKGJRbzaAOUtBUcjF5hLtaSHnJUqXmtiaLEoi53zeWSizeA@mail.gmail.com1 parent92e7a53 commit99c7541
1 file changed
+28
-1
lines changedLines changed: 28 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
436 | 436 |
| |
437 | 437 |
| |
438 | 438 |
| |
439 |
| - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
440 | 444 |
| |
441 | 445 |
| |
442 | 446 |
| |
| |||
701 | 705 |
| |
702 | 706 |
| |
703 | 707 |
| |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
704 | 715 |
| |
705 | 716 |
| |
706 | 717 |
| |
| |||
713 | 724 |
| |
714 | 725 |
| |
715 | 726 |
| |
| 727 | + | |
716 | 728 |
| |
717 | 729 |
| |
718 | 730 |
| |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
719 | 738 |
| |
720 | 739 |
| |
721 | 740 |
| |
| |||
728 | 747 |
| |
729 | 748 |
| |
730 | 749 |
| |
| 750 | + | |
731 | 751 |
| |
732 | 752 |
| |
733 | 753 |
| |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
734 | 761 |
| |
735 | 762 |
| |
736 | 763 |
| |
|
0 commit comments
Comments
(0)