Commit 8ad51b5
committed
Sample postgres_fdw tables remotely during ANALYZE
When collecting ANALYZE sample on foreign tables, postgres_fdw fetched
all rows and performed the sampling locally. For large tables this means
transferring and immediately discarding large amounts of data.
This commit allows the sampling to be performed on the remote server,
transferring only the much smaller sample. The sampling is performed
using the built-in TABLESAMPLE methods (system, bernoulli) or random()
function, depending on the remote server version.
Remote sampling can be enabled by analyze_sampling on the foreign server
and/or foreign table, with supported values 'off', 'auto', 'system',
'bernoulli' and 'random'. The default value is 'auto' which uses either
'bernoulli' (TABLESAMPLE method) or 'random' (for remote servers without
TABLESAMPLE support).1 parent 02699bc commit 8ad51b5
File tree
7 files changed
+397
-9
lines changed- contrib/postgres_fdw
- expected
- sql
- doc/src/sgml
7 files changed
+397
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2367 | 2367 | | |
2368 | 2368 | | |
2369 | 2369 | | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
2370 | 2391 | | |
2371 | 2392 | | |
2372 | 2393 | | |
2373 | 2394 | | |
2374 | 2395 | | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
2375 | 2416 | | |
2376 | 2417 | | |
2377 | | - | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
2378 | 2421 | | |
2379 | 2422 | | |
2380 | 2423 | | |
| |||
2422 | 2465 | | |
2423 | 2466 | | |
2424 | 2467 | | |
2425 | | - | |
| 2468 | + | |
| 2469 | + | |
2426 | 2470 | | |
2427 | 2471 | | |
2428 | 2472 | | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
2429 | 2497 | | |
2430 | 2498 | | |
2431 | 2499 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11779 | 11779 | | |
11780 | 11780 | | |
11781 | 11781 | | |
| 11782 | + | |
| 11783 | + | |
| 11784 | + | |
| 11785 | + | |
| 11786 | + | |
| 11787 | + | |
| 11788 | + | |
| 11789 | + | |
| 11790 | + | |
| 11791 | + | |
| 11792 | + | |
| 11793 | + | |
| 11794 | + | |
| 11795 | + | |
| 11796 | + | |
| 11797 | + | |
| 11798 | + | |
| 11799 | + | |
| 11800 | + | |
| 11801 | + | |
| 11802 | + | |
| 11803 | + | |
| 11804 | + | |
| 11805 | + | |
| 11806 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
213 | 230 | | |
214 | 231 | | |
215 | 232 | | |
| |||
257 | 274 | | |
258 | 275 | | |
259 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
260 | 281 | | |
261 | 282 | | |
262 | 283 | | |
| |||
0 commit comments