forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitec7eef6
committed
Avoid caching expression state trees for domain constraints across queries.
In commit8abb3cd I attempted to cachethe expression state trees constructed for domain CHECK constraints forthe life of the backend (assuming the domain's constraints don't getredefined). However, this turns out not to work very well, becauseexecQual.c will run those state trees with ecxt_per_query_memory pointingto a query-lifespan context, and in some situations we'll end up withpointers into that context getting stored into the state trees. Thishappens in particular with SQL-language functions, as reported byEmre Hasegeli, but there are many other cases.To fix, keep only the expression plan trees for domain CHECK constraintsin the typcache's data structure, and revert to performing ExecInitExpr(at least) once per query to set up expression state trees in the query'scontext.Eventually it'd be nice to undo this, but that will require some carefulthought about memory management for expression state trees, and it seemsfar too late for any such redesign in 9.5. This way is still much moreefficient than what happened before8abb3cd.1 parent8d32717 commitec7eef6
File tree
4 files changed
+108
-4
lines changed- src
- backend/utils/cache
- include/utils
- test/regress
- expected
- sql
4 files changed
+108
-4
lines changedLines changed: 58 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
94 | 94 |
| |
95 | 95 |
| |
96 | 96 |
| |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
97 | 104 |
| |
98 | 105 |
| |
99 | 106 |
| |
| |||
152 | 159 |
| |
153 | 160 |
| |
154 | 161 |
| |
| 162 | + | |
155 | 163 |
| |
156 | 164 |
| |
157 | 165 |
| |
| |||
762 | 770 |
| |
763 | 771 |
| |
764 | 772 |
| |
765 |
| - | |
| 773 | + | |
766 | 774 |
| |
767 | 775 |
| |
768 | 776 |
| |
769 | 777 |
| |
770 | 778 |
| |
771 |
| - | |
| 779 | + | |
| 780 | + | |
772 | 781 |
| |
773 | 782 |
| |
774 | 783 |
| |
| |||
913 | 922 |
| |
914 | 923 |
| |
915 | 924 |
| |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
916 | 959 |
| |
917 | 960 |
| |
918 | 961 |
| |
| |||
926 | 969 |
| |
927 | 970 |
| |
928 | 971 |
| |
| 972 | + | |
929 | 973 |
| |
930 | 974 |
| |
931 | 975 |
| |
| |||
935 | 979 |
| |
936 | 980 |
| |
937 | 981 |
| |
938 |
| - | |
| 982 | + | |
| 983 | + | |
939 | 984 |
| |
940 | 985 |
| |
941 | 986 |
| |
| |||
969 | 1014 |
| |
970 | 1015 |
| |
971 | 1016 |
| |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
972 | 1025 |
| |
973 | 1026 |
| |
974 | 1027 |
| |
| |||
978 | 1031 |
| |
979 | 1032 |
| |
980 | 1033 |
| |
981 |
| - | |
| 1034 | + | |
| 1035 | + | |
982 | 1036 |
| |
983 | 1037 |
| |
984 | 1038 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
130 | 130 |
| |
131 | 131 |
| |
132 | 132 |
| |
| 133 | + | |
133 | 134 |
| |
134 | 135 |
| |
135 | 136 |
| |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
682 | 682 |
| |
683 | 683 |
| |
684 | 684 |
| |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
685 | 710 |
| |
686 | 711 |
| |
687 | 712 |
| |
|
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
515 | 515 |
| |
516 | 516 |
| |
517 | 517 |
| |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
518 | 542 |
| |
519 | 543 |
| |
520 | 544 |
| |
|
0 commit comments
Comments
(0)