forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc3ffe34
committed
Avoid creating duplicate cached plans for inherited FK constraints.
When a foreign key constraint is applied to a partitioned table, eachleaf partition inherits a similar FK constraint. We were processing allof those constraints independently, meaning that in large partitioningtrees we'd build up large collections of cached FK-checking query plans.However, in all cases but one, the generated queries are actuallyidentical for all members of the inheritance tree (because, in mostcases, the query only mentions the topmost table of the other side ofthe FK relationship). So we can share a single cached plan among allthe partitions, saving memory, not to mention time to build and maintainthe cached plans.Keisuke Kuroda and Amit LangoteDiscussion:https://postgr.es/m/cab4b85d-9292-967d-adf2-be0d803c3e23@nttcom.co.jp_11 parentb124363 commitc3ffe34
File tree
3 files changed
+97
-4
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+97
-4
lines changedLines changed: 63 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
101 | 101 |
| |
102 | 102 |
| |
103 | 103 |
| |
104 |
| - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
105 | 108 |
| |
106 | 109 |
| |
107 | 110 |
| |
| |||
207 | 210 |
| |
208 | 211 |
| |
209 | 212 |
| |
| 213 | + | |
210 | 214 |
| |
211 | 215 |
| |
212 | 216 |
| |
| |||
1892 | 1896 |
| |
1893 | 1897 |
| |
1894 | 1898 |
| |
1895 |
| - | |
| 1899 | + | |
1896 | 1900 |
| |
1897 | 1901 |
| |
1898 | 1902 |
| |
| |||
1902 | 1906 |
| |
1903 | 1907 |
| |
1904 | 1908 |
| |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
1905 | 1923 |
| |
1906 | 1924 |
| |
1907 | 1925 |
| |
1908 |
| - | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
1909 | 1930 |
| |
1910 | 1931 |
| |
1911 | 1932 |
| |
| |||
2051 | 2072 |
| |
2052 | 2073 |
| |
2053 | 2074 |
| |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
2054 | 2080 |
| |
2055 | 2081 |
| |
| 2082 | + | |
| 2083 | + | |
2056 | 2084 |
| |
2057 | 2085 |
| |
2058 | 2086 |
| |
| |||
2082 | 2110 |
| |
2083 | 2111 |
| |
2084 | 2112 |
| |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
2085 | 2137 |
| |
2086 | 2138 |
| |
2087 | 2139 |
| |
| |||
2117 | 2169 |
| |
2118 | 2170 |
| |
2119 | 2171 |
| |
2120 |
| - | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
2121 | 2180 |
| |
2122 | 2181 |
| |
2123 | 2182 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2470 | 2470 |
| |
2471 | 2471 |
| |
2472 | 2472 |
| |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + |
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1738 | 1738 |
| |
1739 | 1739 |
| |
1740 | 1740 |
| |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + |
0 commit comments
Comments
(0)