- Notifications
You must be signed in to change notification settings - Fork5
Commit0e5e167
committed
Collect and use element-frequency statistics for arrays.
This patch improves selectivity estimation for the array <@, &&, and @>(containment and overlaps) operators. It enables collection of statisticsabout individual array element values by ANALYZE, and introducesoperator-specific estimators that use these stats. In addition,ScalarArrayOpExpr constructs of the forms "const = ANY/ALL (array_column)"and "const <> ANY/ALL (array_column)" are estimated by treating them asvariants of the containment operators.Since we still collect scalar-style stats about the array values as awhole, the pg_stats view is expanded to show both these stats and thearray-style stats in separate columns. This creates an incompatible changein how stats for tsvector columns are displayed in pg_stats: the statsabout lexemes are now displayed in the array-related columns instead of theoriginal scalar-related columns.There are a few loose ends here, notably that it'd be nice to be able tosuppress either the scalar-style stats or the array-element stats forcolumns for which they're not useful. But the patch is in good enoughshape to commit for wider testing.Alexander Korotkov, reviewed by Noah Misch and Nathan Boley1 parent34c9784 commit0e5e167
File tree
24 files changed
+2341
-168
lines changed- doc/src/sgml
- src
- backend
- catalog
- commands
- tsearch
- utils/adt
- include
- catalog
- commands
- utils
- test/regress
- expected
- sql
24 files changed
+2341
-168
lines changedLines changed: 40 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5354 | 5354 |
| |
5355 | 5355 |
| |
5356 | 5356 |
| |
5357 |
| - | |
5358 |
| - | |
5359 |
| - | |
| 5357 | + | |
| 5358 | + | |
| 5359 | + | |
5360 | 5360 |
| |
5361 | 5361 |
| |
5362 | 5362 |
| |
| |||
8291 | 8291 |
| |
8292 | 8292 |
| |
8293 | 8293 |
| |
8294 |
| - | |
8295 |
| - | |
8296 | 8294 |
| |
8297 | 8295 |
| |
8298 | 8296 |
| |
| |||
8301 | 8299 |
| |
8302 | 8300 |
| |
8303 | 8301 |
| |
8304 |
| - | |
| 8302 | + | |
8305 | 8303 |
| |
8306 | 8304 |
| |
8307 |
| - | |
8308 |
| - | |
8309 |
| - | |
8310 | 8305 |
| |
8311 | 8306 |
| |
8312 | 8307 |
| |
| |||
8338 | 8333 |
| |
8339 | 8334 |
| |
8340 | 8335 |
| |
| 8336 | + | |
| 8337 | + | |
| 8338 | + | |
| 8339 | + | |
| 8340 | + | |
| 8341 | + | |
| 8342 | + | |
| 8343 | + | |
| 8344 | + | |
| 8345 | + | |
| 8346 | + | |
| 8347 | + | |
| 8348 | + | |
| 8349 | + | |
| 8350 | + | |
| 8351 | + | |
| 8352 | + | |
| 8353 | + | |
| 8354 | + | |
| 8355 | + | |
| 8356 | + | |
| 8357 | + | |
| 8358 | + | |
| 8359 | + | |
| 8360 | + | |
| 8361 | + | |
| 8362 | + | |
| 8363 | + | |
| 8364 | + | |
| 8365 | + | |
| 8366 | + | |
| 8367 | + | |
| 8368 | + | |
| 8369 | + | |
| 8370 | + | |
8341 | 8371 |
| |
8342 | 8372 |
| |
8343 | 8373 |
| |
8344 | 8374 |
| |
8345 | 8375 |
| |
8346 |
| - | |
8347 |
| - | |
| 8376 | + | |
8348 | 8377 |
| |
8349 | 8378 |
| |
8350 | 8379 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1182 | 1182 |
| |
1183 | 1183 |
| |
1184 | 1184 |
| |
1185 |
| - | |
| 1185 | + | |
1186 | 1186 |
| |
1187 | 1187 |
| |
1188 | 1188 |
| |
|
Lines changed: 34 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
117 | 117 |
| |
118 | 118 |
| |
119 | 119 |
| |
120 |
| - | |
121 |
| - | |
122 |
| - | |
123 |
| - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
124 | 125 |
| |
125 | 126 |
| |
126 |
| - | |
127 |
| - | |
128 |
| - | |
129 |
| - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
130 | 132 |
| |
131 | 133 |
| |
132 | 134 |
| |
133 | 135 |
| |
134 | 136 |
| |
135 | 137 |
| |
| 138 | + | |
136 | 139 |
| |
137 | 140 |
| |
138 | 141 |
| |
139 | 142 |
| |
140 | 143 |
| |
141 | 144 |
| |
142 |
| - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
143 | 168 |
| |
144 | 169 |
| |
145 | 170 |
| |
|
Lines changed: 5 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
110 | 110 |
| |
111 | 111 |
| |
112 | 112 |
| |
113 |
| - | |
114 |
| - | |
115 | 113 |
| |
116 | 114 |
| |
117 | 115 |
| |
| |||
476 | 474 |
| |
477 | 475 |
| |
478 | 476 |
| |
479 |
| - | |
480 |
| - | |
| 477 | + | |
481 | 478 |
| |
482 | 479 |
| |
483 | 480 |
| |
| |||
490 | 487 |
| |
491 | 488 |
| |
492 | 489 |
| |
| 490 | + | |
493 | 491 |
| |
494 | 492 |
| |
495 |
| - | |
496 |
| - | |
| 493 | + | |
497 | 494 |
| |
| 495 | + | |
498 | 496 |
| |
499 | 497 |
| |
500 | 498 |
| |
| |||
1794 | 1792 |
| |
1795 | 1793 |
| |
1796 | 1794 |
| |
1797 |
| - | |
| 1795 | + | |
1798 | 1796 |
| |
1799 | 1797 |
| |
1800 | 1798 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
609 | 609 |
| |
610 | 610 |
| |
611 | 611 |
| |
612 |
| - | |
| 612 | + | |
613 | 613 |
| |
614 | 614 |
| |
615 | 615 |
| |
| |||
1140 | 1140 |
| |
1141 | 1141 |
| |
1142 | 1142 |
| |
1143 |
| - | |
| 1143 | + | |
1144 | 1144 |
| |
1145 | 1145 |
| |
1146 | 1146 |
| |
| |||
1450 | 1450 |
| |
1451 | 1451 |
| |
1452 | 1452 |
| |
1453 |
| - | |
| 1453 | + | |
1454 | 1454 |
| |
1455 | 1455 |
| |
1456 | 1456 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
220 | 220 |
| |
221 | 221 |
| |
222 | 222 |
| |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
223 | 227 |
| |
224 | 228 |
| |
225 | 229 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
377 | 377 |
| |
378 | 378 |
| |
379 | 379 |
| |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
380 | 385 |
| |
381 | 386 |
| |
382 | 387 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
18 |
| - | |
| 18 | + | |
| 19 | + | |
19 | 20 |
| |
20 | 21 |
| |
21 | 22 |
| |
|
0 commit comments
Comments
(0)