-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#18095] YSQL: Enable Postgres parallel query
Summary: Enable Postgres' parallel query feature and implement parallel scan of YB tables in YBSeqScan, IndexScan, IndexOnlyScan nodes. Feature is enabled in preview mode, that is, it is disabled by default, to enable: ``` set yb_parallel_range_rows to 10000; ``` indicates the number of estimated rows per parallel worker. Smaller table scans are not parallelized, default 0 effectively disables the feature. The parameter defines minimum number of parallel workers, while `max_parallel_workers_per_gather` works as the maximum. ``` set yb_enable_base_scans_cost_model to true; ``` since parallel query cost improvements are factored in Yugabyte costing functions. Also make sure the target tables are large and ANALYZE was done for them. Due to planned parallelization overhead optimizer selects parallel plan only if it thinks the target table is large, default 1000 rows would not be sufficient. The feature depends on the DocDB ability to return key ranges for parallel scan implemented in D26978. Those key ranges are stored in the shared memory buffer from where they are taken one at a time by the parallel workers. Transaction consistency between parallel workers is ensured by main backend sharing its session and transaction context. Jira: DB-7135 Test Plan: ybd --java-test org.yb.pgsql.TestPgRegressParallel ybd --cxx-test pggate_test_select --gtest_filter PggateTestSelect.TestSelectHashRanges ybd --cxx-test pggate_test_select --gtest_filter PggateTestSelect.TestSelectScanRanges Reviewers: sergei, timur, jason, pjain, tnayak Reviewed By: pjain, tnayak Subscribers: ybase, smishra, yql, bogdan Differential Revision: https://phorge.dev.yugabyte.com/D28398
- Loading branch information
1 parent
33fdb83
commit 2f91e3e
Showing
58 changed files
with
3,906 additions
and
343 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgRegressParallel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) YugaByte, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
// in compliance with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the License | ||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
// or implied. See the License for the specific language governing permissions and limitations | ||
// under the License. | ||
// | ||
package org.yb.pgsql; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.yb.YBTestRunner; | ||
|
||
/** | ||
* Runs the pg_regress test suite on YB code. | ||
*/ | ||
@RunWith(value=YBTestRunner.class) | ||
public class TestPgRegressParallel extends BasePgSQLTest { | ||
@Override | ||
public int getTestMethodTimeoutSec() { | ||
return 1800; | ||
} | ||
|
||
@Test | ||
public void testPgRegressParallel() throws Exception { | ||
runPgRegressTest("yb_parallelquery_serial_schedule"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.