0

I'm indexing a partitioned table with about 200 million rows, each row is ~1kb in size. I run multiple CREATE INDEX statements sequentially and its pegging the CPU at 100% for 2 hours. Is there a way i can make this less CPU intensive ?

It is worth noting i have increased maintenance_work_mem to ~2GB before executing, so that might've invited more parallelism ?

SHOW max_parallel_maintenance_workers; returns 2

I'm running an db.m6g.large with 2 vCPUs and 8GB memory.

asked Mar 2, 2023 at 6:03
0

1 Answer 1

1

To reduce the CPU consumption of CREATE INDEX, the most effective way is to disable parallel query by setting max_parallel_maintenance_workers = 0. Then CREATE INDEX will only use a single CPU core.

To reduce the time that CREATE INDEX takes to build an index (and so to reduce the time during which it consumes CPU), you can allot more memory to it by raising maintenance_work_mem.

answered Mar 6, 2023 at 2:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.