forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1ebdec8
committed
Rethink handling of pass-by-value leaf datums in SP-GiST.
The existing convention in SP-GiST is that any pass-by-value datatypeis stored in Datum representation, i.e. it's of width sizeof(Datum)even when typlen is less than that. This is okay, or at least it'stoo late to change it, for prefix datums and node-label datums in inner(upper) tuples. But it's problematic for leaf datums, because we'dprefer those to be stored in Postgres' standard on-disk representationso that we can easily extend leaf tuples to carry additional "included"columns.I believe, however, that we can get away with just up and changing that.This would be an unacceptable on-disk-format break, but there are twobig mitigating factors:1. It seems quite unlikely that there are any SP-GiST opclasses outthere that use pass-by-value leaf datatypes. Certainly none of theones in core do, nor has codesearch.debian.net heard of any. Givenwhat SP-GiST is good for, it's hard to conceive of a use-case wherethe leaf-level values would be both small and fixed-width. (As anexample, if you wanted to index text values with the leaf level beingjust a byte, then every text string would have to be representedwith one level of inner tuple per preceding byte, which would behorrendously space-inefficient and slow to access. You always wantto use as few inner-tuple levels as possible, leaving as much aspossible in the leaf values.)2. Even granting that you have such an index, this change onlybreaks things on big-endian machines. On little-endian, the highorder bytes of the Datum format will now just appear to be alignmentpadding space.So, change the code to store pass-by-value leaf datums in theirusual on-disk form. Inner-tuple datums are not touched.This is extracted from a larger patch that intends to add support for"included" columns. I'm committing it separately for visibility inour commit logs.Pavel Borisov and Tom Lane, reviewed by Andrey BorodinDiscussion:https://postgr.es/m/CALT9ZEFi-vMp4faht9f9Junb1nO3NOSjhpxTmbm1UGLMsLqiEQ@mail.gmail.com1 parentc9c41c7 commit1ebdec8
File tree
3 files changed
+94
-49
lines changed- src
- backend/access/spgist
- include/access
3 files changed
+94
-49
lines changedLines changed: 21 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
731 | 731 |
| |
732 | 732 |
| |
733 | 733 |
| |
734 |
| - | |
735 |
| - | |
736 |
| - | |
737 |
| - | |
738 |
| - | |
739 |
| - | |
740 |
| - | |
741 | 734 |
| |
742 | 735 |
| |
743 | 736 |
| |
| |||
757 | 750 |
| |
758 | 751 |
| |
759 | 752 |
| |
760 |
| - | |
| 753 | + | |
| 754 | + | |
761 | 755 |
| |
762 | 756 |
| |
763 | 757 |
| |
| |||
782 | 776 |
| |
783 | 777 |
| |
784 | 778 |
| |
785 |
| - | |
| 779 | + | |
| 780 | + | |
786 | 781 |
| |
787 | 782 |
| |
788 | 783 |
| |
| |||
814 | 809 |
| |
815 | 810 |
| |
816 | 811 |
| |
817 |
| - | |
| 812 | + | |
| 813 | + | |
818 | 814 |
| |
819 | 815 |
| |
820 | 816 |
| |
| |||
1940 | 1936 |
| |
1941 | 1937 |
| |
1942 | 1938 |
| |
1943 |
| - | |
1944 |
| - | |
1945 |
| - | |
1946 |
| - | |
| 1939 | + | |
| 1940 | + | |
1947 | 1941 |
| |
| 1942 | + | |
1948 | 1943 |
| |
1949 |
| - | |
1950 |
| - | |
1951 |
| - | |
1952 |
| - | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
1953 | 1949 |
| |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
1954 | 1954 |
| |
1955 | 1955 |
| |
1956 | 1956 |
| |
| |||
2161 | 2161 |
| |
2162 | 2162 |
| |
2163 | 2163 |
| |
2164 |
| - | |
2165 |
| - | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
2166 | 2167 |
| |
2167 | 2168 |
| |
2168 | 2169 |
| |
|
Lines changed: 50 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
603 | 603 |
| |
604 | 604 |
| |
605 | 605 |
| |
606 |
| - | |
| 606 | + | |
| 607 | + | |
607 | 608 |
| |
608 |
| - | |
609 |
| - | |
| 609 | + | |
| 610 | + | |
610 | 611 |
| |
611 | 612 |
| |
612 |
| - | |
| 613 | + | |
613 | 614 |
| |
614 | 615 |
| |
615 | 616 |
| |
| |||
624 | 625 |
| |
625 | 626 |
| |
626 | 627 |
| |
627 |
| - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
628 | 647 |
| |
629 | 648 |
| |
630 |
| - | |
| 649 | + | |
631 | 650 |
| |
632 | 651 |
| |
633 | 652 |
| |
| |||
642 | 661 |
| |
643 | 662 |
| |
644 | 663 |
| |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
645 | 683 |
| |
646 | 684 |
| |
647 | 685 |
| |
| |||
655 | 693 |
| |
656 | 694 |
| |
657 | 695 |
| |
658 |
| - | |
| 696 | + | |
659 | 697 |
| |
660 | 698 |
| |
661 | 699 |
| |
| |||
671 | 709 |
| |
672 | 710 |
| |
673 | 711 |
| |
674 |
| - | |
| 712 | + | |
675 | 713 |
| |
676 | 714 |
| |
677 | 715 |
| |
| |||
692 | 730 |
| |
693 | 731 |
| |
694 | 732 |
| |
695 |
| - | |
| 733 | + | |
696 | 734 |
| |
697 | 735 |
| |
698 | 736 |
| |
| |||
716 | 754 |
| |
717 | 755 |
| |
718 | 756 |
| |
719 |
| - | |
| 757 | + | |
720 | 758 |
| |
721 | 759 |
| |
722 | 760 |
| |
| |||
736 | 774 |
| |
737 | 775 |
| |
738 | 776 |
| |
739 |
| - | |
| 777 | + | |
740 | 778 |
| |
741 | 779 |
| |
742 | 780 |
| |
| |||
781 | 819 |
| |
782 | 820 |
| |
783 | 821 |
| |
784 |
| - | |
| 822 | + | |
785 | 823 |
| |
786 | 824 |
| |
787 | 825 |
| |
|
Lines changed: 23 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
266 | 266 |
| |
267 | 267 |
| |
268 | 268 |
| |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
269 | 277 |
| |
270 | 278 |
| |
271 | 279 |
| |
| |||
307 | 315 |
| |
308 | 316 |
| |
309 | 317 |
| |
310 |
| - | |
311 |
| - | |
| 318 | + | |
312 | 319 |
| |
313 | 320 |
| |
314 | 321 |
| |
| |||
322 | 329 |
| |
323 | 330 |
| |
324 | 331 |
| |
325 |
| - | |
| 332 | + | |
326 | 333 |
| |
327 |
| - | |
328 |
| - | |
| 334 | + | |
| 335 | + | |
329 | 336 |
| |
330 | 337 |
| |
| 338 | + | |
| 339 | + | |
| 340 | + | |
331 | 341 |
| |
332 | 342 |
| |
333 | 343 |
| |
| |||
339 | 349 |
| |
340 | 350 |
| |
341 | 351 |
| |
342 |
| - | |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 |
| - | |
347 |
| - | |
348 |
| - | |
| 352 | + | |
| 353 | + | |
349 | 354 |
| |
350 | 355 |
| |
351 | 356 |
| |
352 | 357 |
| |
353 | 358 |
| |
354 | 359 |
| |
355 | 360 |
| |
356 |
| - | |
| 361 | + | |
357 | 362 |
| |
358 | 363 |
| |
359 | 364 |
| |
360 | 365 |
| |
361 | 366 |
| |
362 | 367 |
| |
363 |
| - | |
364 |
| - | |
365 |
| - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
366 | 371 |
| |
367 | 372 |
| |
368 | 373 |
| |
| |||
455 | 460 |
| |
456 | 461 |
| |
457 | 462 |
| |
458 |
| - | |
| 463 | + | |
| 464 | + | |
459 | 465 |
| |
460 | 466 |
| |
461 | 467 |
| |
|
0 commit comments
Comments
(0)