| 1 | #pragma once |
| 2 | |
| 3 | #include <Poco/Timespan.h> |
| 4 | #include <Core/Types.h> |
| 5 | |
| 6 | namespace DB |
| 7 | { |
| 8 | |
| 9 | /// Limits for query execution speed. |
| 10 | class ExecutionSpeedLimits |
| 11 | { |
| 12 | public: |
| 13 | /// For rows per second. |
| 14 | size_t min_execution_rps = 0; |
| 15 | size_t max_execution_rps = 0; |
| 16 | /// For bytes per second. |
| 17 | size_t min_execution_bps = 0; |
| 18 | size_t max_execution_bps = 0; |
| 19 | |
| 20 | Poco::Timespan max_execution_time = 0; |
| 21 | /// Verify that the speed is not too low after the specified time has elapsed. |
| 22 | Poco::Timespan timeout_before_checking_execution_speed = 0; |
| 23 | |
| 24 | /// Pause execution in case if speed limits were exceeded. |
| 25 | void throttle(size_t read_rows, size_t read_bytes, size_t total_rows_to_read, UInt64 total_elapsed_microseconds); |
| 26 | }; |
| 27 | |
| 28 | } |
| 29 | |
| 30 | |