forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6fcb337
committed
Redesign tablesample method API, and do extensive code review.
The original implementation of TABLESAMPLE modeled the tablesample methodAPI on index access methods, which wasn't a good choice because, withoutspecialized DDL commands, there's no way to build an extension that canimplement a TSM. (Raw inserts into system catalogs are not an acceptablething to do, because we can't undo them during DROP EXTENSION, nor willpg_upgrade behave sanely.) Instead adopt an API more like procedurallanguage handlers or foreign data wrappers, wherein the only SQL-levelsupport object needed is a single handler function identified by havinga special return type. This lets us get rid of the supporting catalogaltogether, so that no custom DDL support is needed for the feature.Adjust the API so that it can support non-constant tablesample arguments(the original coding assumed we could evaluate the argument expressions atExecInitSampleScan time, which is undesirable even if it weren't outrightunsafe), and discourage sampling methods from looking at invisible tuples.Make sure that the BERNOULLI and SYSTEM methods are genuinely repeatablewithin and across queries, as required by the SQL standard, and deal morehonestly with methods that can't support that requirement.Make a full code-review pass over the tablesample additions, and fixassorted bugs, omissions, infelicities, and cosmetic issues (such asfailure to put the added code stanzas in a consistent ordering).Improve EXPLAIN's output of tablesample plans, too.Back-patch to 9.5 so that we don't have to support the original APIin production.1 parent7d4240d commit6fcb337
File tree
83 files changed
+3116
-2521
lines changed- contrib
- pg_stat_statements
- tsm_system_rows
- expected
- sql
- tsm_system_time
- expected
- sql
- doc/src/sgml
- ref
- src
- backend
- access
- heap
- tablesample
- catalog
- commands
- executor
- nodes
- optimizer
- path
- plan
- prep
- util
- parser
- rewrite
- utils
- adt
- cache
- misc
- bin/psql
- include
- access
- catalog
- executor
- nodes
- optimizer
- parser
- utils
- port
- test/regress
- expected
- output
- sql
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
83 files changed
+3116
-2521
lines changedLines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2297 | 2297 |
| |
2298 | 2298 |
| |
2299 | 2299 |
| |
| 2300 | + | |
2300 | 2301 |
| |
2301 | 2302 |
| |
2302 | 2303 |
| |
| |||
2767 | 2768 |
| |
2768 | 2769 |
| |
2769 | 2770 |
| |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
2770 | 2780 |
| |
2771 | 2781 |
| |
2772 | 2782 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
5 |
| - | |
| 5 | + | |
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
|
Lines changed: 74 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
3 |
| - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
4 | 5 |
| |
5 |
| - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
6 | 25 |
| |
7 | 26 |
| |
8 | 27 |
| |
9 | 28 |
| |
10 | 29 |
| |
11 |
| - | |
12 |
| - | |
13 |
| - | |
14 |
| - | |
15 |
| - | |
16 |
| - | |
17 |
| - | |
18 |
| - | |
19 |
| - | |
20 |
| - | |
21 |
| - | |
22 |
| - | |
23 |
| - | |
24 |
| - | |
25 |
| - | |
26 |
| - | |
27 |
| - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
28 | 78 |
| |
29 | 79 |
| |
30 |
| - | |
31 |
| - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + |
Lines changed: 33 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 |
| - | |
4 |
| - | |
5 |
| - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 |
| |
7 | 7 |
| |
8 |
| - | |
9 |
| - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
10 | 36 |
| |
11 |
| - | |
| 37 | + | |
12 | 38 |
| |
13 |
| - | |
14 |
| - | |
| 39 | + |
Lines changed: 4 additions & 39 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 |
| - | |
7 |
| - | |
8 |
| - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
9 | 9 |
| |
10 |
| - | |
11 |
| - | |
12 |
| - | |
13 |
| - | |
14 |
| - | |
15 |
| - | |
16 |
| - | |
17 |
| - | |
18 |
| - | |
19 |
| - | |
20 |
| - | |
21 |
| - | |
22 |
| - | |
23 |
| - | |
24 |
| - | |
25 |
| - | |
26 |
| - | |
27 |
| - | |
28 |
| - | |
29 |
| - | |
30 |
| - | |
31 |
| - | |
32 |
| - | |
33 |
| - | |
34 |
| - | |
35 |
| - | |
36 |
| - | |
37 |
| - | |
38 |
| - | |
39 |
| - | |
40 |
| - | |
41 |
| - | |
42 |
| - | |
43 |
| - | |
44 |
| - |
0 commit comments
Comments
(0)