- Notifications
You must be signed in to change notification settings - Fork5
Commitba42002
committed
Revise handling of dropped columns in JOIN alias lists to avoid a
performance problem pointed out by phil@vodafone: to wit, we werespending O(N^2) time to check dropped-ness in an N-deep join tree,even in the case where the tree was freshly constructed and couldn'tpossibly mention any dropped columns. Instead of recursing inget_rte_attribute_is_dropped(), change the data structure definition:the joinaliasvars list of a JOIN RTE must have a NULL Const insteadof a Var at any position that references a now-dropped column. Thiscosts nothing during normal parse-rewrite-plan path, and instead wehave a linear-time update to make when loading a stored rule thatmight contain now-dropped columns. While at it, move the responsibilityfor acquring locks on relations referenced by rules into this separatefunction (which I therefore chose to call AcquireRewriteLocks).This saves effort --- namely, duplicated lock grabs in parser and rewriter--- in the normal path at a cost of one extra non-locked heap_open()in the stored-rule path; seems a good tradeoff. A fringe benefit isthat it is now *much* clearer that we acquire lock on relations referencedin rules before we make any rewriter decisions based on their properties.(I don't know of any bug of that ilk, but it wasn't exactly clear before.)1 parent7e209f6 commitba42002
File tree
12 files changed
+278
-90
lines changed- src
- backend
- commands
- optimizer/util
- parser
- rewrite
- tcop
- utils/adt
- include
- nodes
- parser
- rewrite
- tcop
12 files changed
+278
-90
lines changedLines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
100 | 100 |
| |
101 | 101 |
| |
102 | 102 |
| |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
103 | 109 |
| |
104 | 110 |
| |
105 | 111 |
| |
| |||
166 | 172 |
| |
167 | 173 |
| |
168 | 174 |
| |
| 175 | + | |
| 176 | + | |
169 | 177 |
| |
170 | 178 |
| |
171 | 179 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
17 |
| - | |
| 17 | + | |
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
| |||
76 | 76 |
| |
77 | 77 |
| |
78 | 78 |
| |
| 79 | + | |
79 | 80 |
| |
80 | 81 |
| |
81 | 82 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
99 | 99 |
| |
100 | 100 |
| |
101 | 101 |
| |
| 102 | + | |
102 | 103 |
| |
103 | 104 |
| |
104 | 105 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
524 | 524 |
| |
525 | 525 |
| |
526 | 526 |
| |
527 |
| - | |
528 |
| - | |
529 |
| - | |
| 527 | + | |
530 | 528 |
| |
531 | 529 |
| |
532 | 530 |
| |
|
Lines changed: 13 additions & 32 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
1202 | 1202 |
| |
1203 | 1203 |
| |
1204 | 1204 |
| |
1205 |
| - | |
1206 |
| - | |
| 1205 | + | |
1207 | 1206 |
| |
1208 | 1207 |
| |
1209 | 1208 |
| |
| |||
1358 | 1357 |
| |
1359 | 1358 |
| |
1360 | 1359 |
| |
| 1360 | + | |
| 1361 | + | |
1361 | 1362 |
| |
1362 | 1363 |
| |
1363 | 1364 |
| |
1364 | 1365 |
| |
1365 | 1366 |
| |
1366 | 1367 |
| |
1367 | 1368 |
| |
1368 |
| - | |
| 1369 | + | |
| 1370 | + | |
1369 | 1371 |
| |
1370 |
| - | |
1371 |
| - | |
| 1372 | + | |
1372 | 1373 |
| |
1373 | 1374 |
| |
1374 | 1375 |
| |
1375 | 1376 |
| |
1376 | 1377 |
| |
1377 |
| - | |
| 1378 | + | |
1378 | 1379 |
| |
1379 |
| - | |
1380 |
| - | |
1381 |
| - | |
1382 |
| - | |
1383 |
| - | |
1384 |
| - | |
1385 | 1380 |
| |
1386 |
| - | |
1387 |
| - | |
| 1381 | + | |
1388 | 1382 |
| |
1389 | 1383 |
| |
1390 | 1384 |
| |
| |||
1399 | 1393 |
| |
1400 | 1394 |
| |
1401 | 1395 |
| |
1402 |
| - | |
1403 | 1396 |
| |
1404 | 1397 |
| |
1405 | 1398 |
| |
| |||
1711 | 1704 |
| |
1712 | 1705 |
| |
1713 | 1706 |
| |
1714 |
| - | |
| 1707 | + | |
1715 | 1708 |
| |
1716 |
| - | |
1717 | 1709 |
| |
1718 | 1710 |
| |
1719 | 1711 |
| |
| |||
1750 | 1742 |
| |
1751 | 1743 |
| |
1752 | 1744 |
| |
1753 |
| - | |
1754 |
| - | |
| 1745 | + | |
| 1746 | + | |
1755 | 1747 |
| |
1756 | 1748 |
| |
1757 | 1749 |
| |
| |||
1760 | 1752 |
| |
1761 | 1753 |
| |
1762 | 1754 |
| |
1763 |
| - | |
1764 |
| - | |
1765 |
| - | |
1766 |
| - | |
1767 |
| - | |
1768 |
| - | |
1769 |
| - | |
1770 |
| - | |
1771 |
| - | |
1772 |
| - | |
1773 |
| - | |
1774 |
| - | |
| 1755 | + | |
1775 | 1756 |
| |
1776 | 1757 |
| |
1777 | 1758 |
| |
|
0 commit comments
Comments
(0)