Help Center/
GaussDB/
Developer Guide(Distributed_V2.0-8.x)/
FAQs/
How do I create indexes in parallel?
Updated on 2025-08-19 GMT+08:00
How do I create indexes in parallel?
Answer: GaussDB supports parallel index creation to improve the index creation efficiency.
Example:
-- Set maintenance_work_mem based on the actual situation. gaussdb=# SET maintenance_work_mem = '8GB'; -- Create a table. gaussdb=# CREATE TABLE table_name (col1 int, col2 int); -- Change the number of threads for creating indexes for a table based on the actual situation. gaussdb=# ALTER TABLE table_name SET (parallel_workers=4); -- Create an index. gaussdb=# CREATE INDEX index_name ON table_name(col1); -- Reset the parallel_workers parameter for the table. gaussdb=# ALTER TABLE table_name RESET (parallel_workers); -- Delete the index. DROP INDEX index_name; -- Drop the table. gaussdb=# DROP TABLE table_name;
Parent topic: FAQs
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.