views:

66

answers:

1

I have a Postgres instance building a GIN index. It's looking at about 200,000 rows and it's so far taken about 9 hours. Who knows how long it will take eventually. The problem is that it's using about 2% of CPU when I'd like it to use more like 90%. Is there any way to force it to speed up?

+1  A: 

The main bottleneck is probably disk IO and not CPU.

If you're on a Windows machine, you can check disk IOs using Process Explorer (freeware), if on Unix, use iostat, sar, DTrace (haven't done the latter in a while so not 100% sure of the best tool)

DVK
The Resource Monitor on Windows also shows this and you can usually easily see there whether the machine is currently CPU-limited or by IO.
Joey
Joe
I think it was due to paging, leading to thrashing. The answer was to increase the working memory by `set maintenance_work_mem = 102400;`.
Joe