forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3f2393e
committed
Redesign initialization of partition routing structures
This speeds up write operations (INSERT, UPDATE, DELETE, COPY, as wellas the future MERGE) on partitioned tables.This changes the setup for tuple routing so that it does far less workduring the initial setup and pushes more work out to when partitionsreceive tuples. PartitionDispatchData structs for sub-partitionedtables are only created when a tuple gets routed through it. Thepossibly large arrays in the PartitionTupleRouting struct have largelybeen removed. The partitions[] array remains but now never contains anyNULL gaps. Previously the NULLs had to be skipped duringExecCleanupTupleRouting(), which could add a large overhead to thecleanup when the number of partitions was large. The partitions[] arrayis allocated small to start with and only enlarged when we route tuplesto enough partitions that it runs out of space. This allows us to keepsimple single-row partition INSERTs running quickly. RedesignThe arrays in PartitionTupleRouting which stored the tuple translation mapshave now been removed. These have been moved out into aPartitionRoutingInfo struct which is an additional field in ResultRelInfo.The find_all_inheritors() call still remains by far the slowest part ofExecSetupPartitionTupleRouting(). This commit just removes the other slowparts.In passing also rename the tuple translation maps from being ParentToChildand ChildToParent to being RootToPartition and PartitionToRoot. The oldnames mislead you into thinking that a partition of some sub-partitionedtable would translate to the rowtype of the sub-partitioned table ratherthan the root partitioned table.Authors: David Rowley and Amit Langote, heavily revised by Álvaro HerreraTesting help from Jesper Pedersen and Kato Sho.Discussion:https://postgr.es/m/CAKJS1f_1RJyFquuCKRFHTdcXqoPX-PYqAd7nz=GVBwvGh4a6xA@mail.gmail.com1 parenta387a3d commit3f2393e
File tree
9 files changed
+637
-714
lines changed- src
- backend
- commands
- executor
- optimizer/prep
- utils/cache
- include
- catalog
- executor
- nodes
9 files changed
+637
-714
lines changedLines changed: 24 additions & 62 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2316 | 2316 |
| |
2317 | 2317 |
| |
2318 | 2318 |
| |
| 2319 | + | |
2319 | 2320 |
| |
2320 | 2321 |
| |
2321 | 2322 |
| |
| |||
2331 | 2332 |
| |
2332 | 2333 |
| |
2333 | 2334 |
| |
2334 |
| - | |
2335 | 2335 |
| |
2336 | 2336 |
| |
2337 | 2337 |
| |
| |||
2515 | 2515 |
| |
2516 | 2516 |
| |
2517 | 2517 |
| |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
2518 | 2522 |
| |
2519 |
| - | |
| 2523 | + | |
2520 | 2524 |
| |
2521 | 2525 |
| |
2522 | 2526 |
| |
| |||
2526 | 2530 |
| |
2527 | 2531 |
| |
2528 | 2532 |
| |
2529 |
| - | |
2530 | 2533 |
| |
2531 | 2534 |
| |
2532 |
| - | |
2533 |
| - | |
2534 |
| - | |
2535 |
| - | |
2536 |
| - | |
2537 |
| - | |
2538 |
| - | |
2539 |
| - | |
2540 |
| - | |
2541 |
| - | |
2542 | 2535 |
| |
2543 | 2536 |
| |
2544 | 2537 |
| |
| |||
2694 | 2687 |
| |
2695 | 2688 |
| |
2696 | 2689 |
| |
2697 |
| - | |
2698 | 2690 |
| |
2699 | 2691 |
| |
2700 | 2692 |
| |
2701 |
| - | |
2702 |
| - | |
2703 |
| - | |
2704 |
| - | |
2705 |
| - | |
2706 |
| - | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
2707 | 2696 |
| |
2708 |
| - | |
2709 |
| - | |
2710 |
| - | |
2711 |
| - | |
2712 |
| - | |
2713 |
| - | |
2714 |
| - | |
2715 |
| - | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
2716 | 2701 |
| |
2717 | 2702 |
| |
2718 | 2703 |
| |
| |||
2725 | 2710 |
| |
2726 | 2711 |
| |
2727 | 2712 |
| |
2728 |
| - | |
2729 |
| - | |
2730 |
| - | |
2731 | 2713 |
| |
2732 | 2714 |
| |
2733 |
| - | |
| 2715 | + | |
2734 | 2716 |
| |
2735 | 2717 |
| |
2736 | 2718 |
| |
| |||
2787 | 2769 |
| |
2788 | 2770 |
| |
2789 | 2771 |
| |
2790 |
| - | |
2791 |
| - | |
2792 |
| - | |
2793 |
| - | |
2794 |
| - | |
2795 |
| - | |
2796 |
| - | |
2797 |
| - | |
2798 |
| - | |
2799 |
| - | |
2800 |
| - | |
2801 |
| - | |
2802 |
| - | |
2803 |
| - | |
2804 |
| - | |
2805 | 2772 |
| |
2806 | 2773 |
| |
2807 | 2774 |
| |
| |||
2827 | 2794 |
| |
2828 | 2795 |
| |
2829 | 2796 |
| |
2830 |
| - | |
| 2797 | + | |
2831 | 2798 |
| |
2832 | 2799 |
| |
2833 | 2800 |
| |
| |||
2837 | 2804 |
| |
2838 | 2805 |
| |
2839 | 2806 |
| |
2840 |
| - | |
| 2807 | + | |
2841 | 2808 |
| |
2842 | 2809 |
| |
2843 | 2810 |
| |
| |||
2850 | 2817 |
| |
2851 | 2818 |
| |
2852 | 2819 |
| |
2853 |
| - | |
2854 |
| - | |
| 2820 | + | |
2855 | 2821 |
| |
2856 | 2822 |
| |
2857 | 2823 |
| |
| |||
2865 | 2831 |
| |
2866 | 2832 |
| |
2867 | 2833 |
| |
2868 |
| - | |
2869 |
| - | |
| 2834 | + | |
| 2835 | + | |
2870 | 2836 |
| |
2871 |
| - | |
| 2837 | + | |
2872 | 2838 |
| |
2873 | 2839 |
| |
2874 | 2840 |
| |
2875 | 2841 |
| |
2876 | 2842 |
| |
2877 |
| - | |
2878 |
| - | |
2879 |
| - | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
2880 | 2846 |
| |
2881 | 2847 |
| |
2882 | 2848 |
| |
| |||
3021 | 2987 |
| |
3022 | 2988 |
| |
3023 | 2989 |
| |
3024 |
| - | |
3025 |
| - | |
3026 |
| - | |
3027 |
| - | |
3028 | 2990 |
| |
3029 |
| - | |
| 2991 | + | |
3030 | 2992 |
| |
3031 | 2993 |
| |
3032 | 2994 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1345 | 1345 |
| |
1346 | 1346 |
| |
1347 | 1347 |
| |
1348 |
| - | |
| 1348 | + | |
1349 | 1349 |
| |
1350 | 1350 |
| |
1351 | 1351 |
| |
|
0 commit comments
Comments
(0)