From 5bea1d19d1db536935aa86327feea7028a3e699d Mon Sep 17 00:00:00 2001 From: Natasha Sehgal Date: Thu, 19 Dec 2024 12:54:42 +0530 Subject: [PATCH 1/2] Add session properties for scaled table scan configs --- .../NativeWorkerSessionPropertyProvider.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/presto-main/src/main/java/com/facebook/presto/sessionpropertyproviders/NativeWorkerSessionPropertyProvider.java b/presto-main/src/main/java/com/facebook/presto/sessionpropertyproviders/NativeWorkerSessionPropertyProvider.java index 08d6c939b6d8..e6461e336e76 100644 --- a/presto-main/src/main/java/com/facebook/presto/sessionpropertyproviders/NativeWorkerSessionPropertyProvider.java +++ b/presto-main/src/main/java/com/facebook/presto/sessionpropertyproviders/NativeWorkerSessionPropertyProvider.java @@ -73,6 +73,8 @@ public class NativeWorkerSessionPropertyProvider public static final String NATIVE_SCALED_WRITER_MAX_PARTITIONS_PER_WRITER = "native_scaled_writer_max_partitions_per_writer"; public static final String NATIVE_SCALED_WRITER_MIN_PARTITION_PROCESSED_BYTES_REBALANCE_THRESHOLD = "native_scaled_writer_min_partition_processed_bytes_rebalance_threshold"; public static final String NATIVE_SCALED_WRITER_MIN_PROCESSED_BYTES_REBALANCE_THRESHOLD = "native_scaled_writer_min_processed_bytes_rebalance_threshold"; + public static final String NATIVE_TABLE_SCAN_SCALED_PROCESSING_ENABLED = "native_table_scan_scaled_processing_enabled"; + public static final String NATIVE_TABLE_SCAN_SCALE_UP_MEMORY_USAGE_RATIO = "native_table_scan_scale_up_memory_usage_ratio"; private final List> sessionProperties; @Inject @@ -309,6 +311,20 @@ public NativeWorkerSessionPropertyProvider(FeaturesConfig featuresConfig) "Minimum amount of data processed by all the logical table partitions " + "to trigger skewed partition rebalancing by scale writer exchange.", 256L << 20, + !nativeExecution), + booleanProperty( + NATIVE_TABLE_SCAN_SCALED_PROCESSING_ENABLED, + "If set to true, enables the scaled table scan processing.", + false, + !nativeExecution), + doubleProperty( + NATIVE_TABLE_SCAN_SCALE_UP_MEMORY_USAGE_RATIO, + "The query memory usage ratio used by scan controller to decide if it can " + + "increase the number of running scan threads. When the query memory usage " + + "is below this ratio, the scan controller keeps increasing the running scan " + + "thread for scale up, and stop once exceeds this ratio. The value is in the " + + "range of [0, 1].", + 0.7, !nativeExecution)); } From 5340b2f92ec163821dc2bed56a51c5f3a9683c3f Mon Sep 17 00:00:00 2001 From: Natasha Sehgal Date: Fri, 20 Dec 2024 13:51:10 +0530 Subject: [PATCH 2/2] add documentation for new table scan session properties --- .../sphinx/presto_cpp/properties-session.rst | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/presto-docs/src/main/sphinx/presto_cpp/properties-session.rst b/presto-docs/src/main/sphinx/presto_cpp/properties-session.rst index b699b922003a..7742842ea0f6 100644 --- a/presto-docs/src/main/sphinx/presto_cpp/properties-session.rst +++ b/presto-docs/src/main/sphinx/presto_cpp/properties-session.rst @@ -419,3 +419,24 @@ writer scaling if it is detected as overloaded by scale writer exchange. Minimum amount of data processed by all the logical table partitions to trigger skewed partition rebalancing by scale writer exchange. + +``native_table_scan_scaled_processing_enabled`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* **Type:** ``boolean`` +* **Default value:** ``false`` + +Enables scaled processing for table scans. +When enabled, Presto will attempt to scale up table scans to improve performance. + +``native_table_scan_scale_up_memory_usage_ratio`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* **Type:** ``double`` +* **Minimum value:** ``0`` +* **Maximum value:** ``1`` +* **Default value:** ``0.7`` + +Controls the ratio of available memory that can be used for scaling up table scans. +A higher value allows more memory to be allocated for scaling up table scans, +while a lower value limits the amount of memory used.