Commit 720b59b
committed
Avoid catalog lookups in RelationAllowsEarlyPruning().
RelationAllowsEarlyPruning() performed a catalog scan, but is used
in two contexts where that was a bad idea:
1. In heap_page_prune_opt(), which runs very frequently in some large
scans. This caused major performance problems in a field report
that was easy to reproduce.
2. In TestForOldSnapshot(), which runs while we hold a buffer content
lock. It's not clear if this was guaranteed to be free of buffer
deadlock risk.
The check was introduced in commit 2cc41ac and defended against a
real problem: 9.6's hash indexes have no page LSN and so we can't
allow early pruning (ie the snapshot-too-old feature). We can remove
the check from all later releases though: hash indexes are now logged,
and there is no way to create UNLOGGED indexes on regular logged
tables.
If a future release allows such a combination, it might need to put
a similar check in place, but it'll need some more thought.
Back-patch to 10.
Author: Thomas Munro
Reviewed-by: Tom Lane, who spotted the second problem
Discussion: https://postgr.es/m/CA%2BhUKGKT8oTkp5jw_U4p0S-7UG9zsvtw_M47Y285bER6a2gD%2Bg%40mail.gmail.com
Discussion: https://postgr.es/m/CAA4eK1%2BWy%2BN4eE5zPm765h68LrkWc3Biu_8rzzi%2BOYX4j%2BiHRw%40mail.gmail.com1 parent 80d0e5b commit 720b59b
File tree
3 files changed
+0
-44
lines changed- src
- backend/utils/cache
- include/utils
3 files changed
+0
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5913 | 5913 | | |
5914 | 5914 | | |
5915 | 5915 | | |
5916 | | - | |
5917 | | - | |
5918 | | - | |
5919 | | - | |
5920 | | - | |
5921 | | - | |
5922 | | - | |
5923 | | - | |
5924 | | - | |
5925 | | - | |
5926 | | - | |
5927 | | - | |
5928 | | - | |
5929 | | - | |
5930 | | - | |
5931 | | - | |
5932 | | - | |
5933 | | - | |
5934 | | - | |
5935 | | - | |
5936 | | - | |
5937 | | - | |
5938 | | - | |
5939 | | - | |
5940 | | - | |
5941 | | - | |
5942 | | - | |
5943 | | - | |
5944 | | - | |
5945 | | - | |
5946 | | - | |
5947 | | - | |
5948 | | - | |
5949 | | - | |
5950 | | - | |
5951 | | - | |
5952 | | - | |
5953 | | - | |
5954 | | - | |
5955 | | - | |
5956 | | - | |
5957 | | - | |
5958 | 5916 | | |
5959 | 5917 | | |
5960 | 5918 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
608 | | - | |
609 | 608 | | |
610 | 609 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
0 commit comments