forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf343a88
committed
Extract restriction OR clauses whether or not they are indexable.
It's possible to extract a restriction OR clause from a join clause thathas the form of an OR-of-ANDs, if each sub-AND includes a clause thatmentions only one specific relation. While PG has been aware of that ideafor many years, the code previously only did it if it could extract anindexable OR clause. On reflection, though, that seems a silly limitation:adding a restriction clause can be a win by reducing the number of rowsthat have to be filtered at the join step, even if we have to test theclause as a plain filter clause during the scan. This should be especiallyuseful for foreign tables, where the change can cut the number of rows thathave to be retrieved from the foreign server; but testing shows it can wineven on local tables. Per a suggestion from Robert Haas.As a heuristic, I made the code accept an extracted restriction clauseif its estimated selectivity is less than 0.9, which will probably resultin accepting extracted clauses just about always. We might need to tweakthat later based on experience.Since the code no longer has even a weak connection to Path creation,remove orindxpath.c and create a new file optimizer/util/orclauses.c.There's some additional janitorial cleanup of now-dead code that needsto happen, but it seems like that's a fit subject for a separate commit.1 parent47f5026 commitf343a88
File tree
11 files changed
+435
-208
lines changed- src
- backend/optimizer
- path
- plan
- util
- include/optimizer
- test/regress
- expected
- sql
11 files changed
+435
-208
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
16 |
| - | |
| 16 | + | |
17 | 17 |
| |
18 | 18 |
|
Lines changed: 0 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
362 | 362 |
| |
363 | 363 |
| |
364 | 364 |
| |
365 |
| - | |
366 |
| - | |
367 |
| - | |
368 |
| - | |
369 |
| - | |
370 |
| - | |
371 |
| - | |
372 |
| - | |
373 |
| - | |
374 |
| - | |
375 |
| - | |
376 | 365 |
| |
377 | 366 |
| |
378 | 367 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1354 | 1354 |
| |
1355 | 1355 |
| |
1356 | 1356 |
| |
1357 |
| - | |
| 1357 | + | |
| 1358 | + | |
1358 | 1359 |
| |
1359 | 1360 |
| |
1360 | 1361 |
| |
|
Lines changed: 0 additions & 187 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
23 | 24 |
| |
24 | 25 |
| |
25 | 26 |
| |
| |||
194 | 195 |
| |
195 | 196 |
| |
196 | 197 |
| |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
197 | 204 |
| |
198 | 205 |
| |
199 | 206 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 |
| - | |
16 |
| - | |
| 15 | + | |
| 16 | + | |
17 | 17 |
| |
18 | 18 |
|
0 commit comments
Comments
(0)