Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

During a single query write of approximately 300,000 rows with 30 columns all indexed, I noticed that only one core was maxed at a time.

Is there any way to calculate indexes multithreaded for single inserts?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Is there any way to calculate indexes multithreaded for single inserts?

Unfortunately, no.

PostgreSQL backends are single-threaded, and a single connection can use only one backend.

There's work to enhance this, but it's a seriously difficult and big job because of PostgreSQL's process-based architecture.

The only real option is to split the insert its self into multiple concurrent connections, each doing part of the work.

share|improve this answer
    
Thank you Craig Ringer! About your last statement, does that mean that Postgres only partially alters the index on each write? –  Cincinnatus Jul 1 at 13:33
1  
@Gracchus the index is incrementally updated, yes. If possible drop it before & recreate it after a big bulk load if you don't mind the impact on concurrent readers. –  Craig Ringer Jul 1 at 14:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.