- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitc9645f7
committed
Second try at fixing O(N^2) problem in foreign key references.
This replaces ill-fated commit5ddc728,which was reverted because it broke active uses of FK cache entries. Inthis patch, we still do nothing more to invalidatable cache entries thanmark them as needing revalidation, so we won't break active uses. To keepdown the overhead of InvalidateConstraintCacheCallBack(), keep a list ofjust the currently-valid cache entries. (The entries are large enough thatsome added space for list links doesn't seem like a big problem.) Thiswould still be O(N^2) when there are many valid entries, though, so whenthe list gets too long, just force the "sinval reset" behavior to removeeverything from the list. I set the threshold at 1000 entries, somewhatarbitrarily. Possibly that could be fine-tuned later. Another item forfuture study is whether it's worth adding reference counting so that wecould safely remove invalidated entries. As-is, problem cases are likelyto end up with large and mostly invalid FK caches.Like the previous attempt, backpatch to 9.3.Jan Wieck and Tom Lane1 parent5eb7024 commitc9645f7
1 file changed
+38
-7
lines changedLines changed: 38 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
| 43 | + | |
43 | 44 |
| |
44 | 45 |
| |
45 | 46 |
| |
| |||
125 | 126 |
| |
126 | 127 |
| |
127 | 128 |
| |
| 129 | + | |
128 | 130 |
| |
129 | 131 |
| |
130 | 132 |
| |
| |||
185 | 187 |
| |
186 | 188 |
| |
187 | 189 |
| |
| 190 | + | |
| 191 | + | |
188 | 192 |
| |
189 | 193 |
| |
190 | 194 |
| |
| |||
2924 | 2928 |
| |
2925 | 2929 |
| |
2926 | 2930 |
| |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
2927 | 2938 |
| |
2928 | 2939 |
| |
2929 | 2940 |
| |
| |||
2936 | 2947 |
| |
2937 | 2948 |
| |
2938 | 2949 |
| |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
2939 | 2956 |
| |
2940 | 2957 |
| |
2941 | 2958 |
| |
2942 | 2959 |
| |
2943 |
| - | |
2944 |
| - | |
| 2960 | + | |
2945 | 2961 |
| |
2946 | 2962 |
| |
2947 | 2963 |
| |
2948 |
| - | |
2949 |
| - | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
2950 | 2974 |
| |
2951 |
| - | |
2952 |
| - | |
2953 |
| - | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
2954 | 2985 |
| |
2955 | 2986 |
| |
2956 | 2987 |
| |
|
0 commit comments
Comments
(0)