- Notifications
You must be signed in to change notification settings - Fork28
Commit166f69f
committed
Fix O(N^2) performance issue in pg_publication_tables view.
The original coding of this view relied on a correlated IN sub-query.Our planner is not very bright about correlated sub-queries, and evenif it were, there's no way for it to know that the output ofpg_get_publication_tables() is duplicate-free, making the de-duplicatingsemantics of IN unnecessary. Hence, rewrite as a LATERAL sub-query.This provides circa 100X speedup for me with a few hundred publishedtables (the whole regression database), and things would degrade asroughly O(published_relations * all_relations) beyond that.Because the rules.out expected output changes, force a catversion bump.Ordinarily we might not want to do that post-beta1; but we already knowwe'll be doing a catversion bump before beta2 to fix pg_statistic_extissues, so it's pretty much free to fix it now instead of waiting for v13.Per report and fix suggestion from PegoraroF10.Discussion:https://postgr.es/m/1551385426763-0.post@n3.nabble.com1 parent728840f commit166f69f
File tree
3 files changed
+7
-6
lines changed- src
- backend/catalog
- include/catalog
- test/regress/expected
3 files changed
+7
-6
lines changedLines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
258 | 258 |
| |
259 | 259 |
| |
260 | 260 |
| |
261 |
| - | |
262 |
| - | |
263 |
| - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
264 | 265 |
| |
265 | 266 |
| |
266 | 267 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1441 | 1441 |
| |
1442 | 1442 |
| |
1443 | 1443 |
| |
| 1444 | + | |
1444 | 1445 |
| |
1445 | 1446 |
| |
1446 |
| - | |
1447 |
| - | |
| 1447 | + | |
1448 | 1448 |
| |
1449 | 1449 |
| |
1450 | 1450 |
| |
|
0 commit comments
Comments
(0)