Re: COPY with high # of clients, partitioned table locking issues?

From: Emanuel Calvo <postgres(dot)arg(at)gmail(dot)com>
To: "Strange, John W" <john(dot)w(dot)strange(at)jpmchase(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: COPY with high # of clients, partitioned table locking issues?
Date: 2011-03-31 10:43:30
Message-ID: AANLkTi=UHm6L7cOe8ryAoahyn=+kSG=tjuqyKt5Kw4kp@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Your message was dropped into my Spam lable :S

2011/3/30 Strange, John W <john(dot)w(dot)strange(at)jpmchase(dot)com>:
> Just some information on our setup:
>
> - HP DL585 G6
> - 4 x AMD Opteron 8435 (24 cores)
> - 256GB RAM
> - 2 FusionIO 640GB PCI-SSD (RAID0)
> - dual 10GB ethernet.
>
> - we have several tables that we store calculated values in.
> - these are inserted by a compute farm that calculates the results and stores them into a partitioned schema (schema listed below)
> - whenever we do a lot of inserts we seem to get exclusive locks.
>
> Is there something we can do to improve the performance around locking when doing a lot of parallel inserts with COPY into?  We are not IO bound, what happens is that the copies start to slow down and continue to come in and cause the client to swap, we had hit over 800+ COPYS were in a waiting state, which forced us to start paging heavily creating an issue.  If we can figure out the locking issue the copys should clear faster requiring less memory in use.
>
> [ 2011-03-30 15:54:55.886 EDT ] 14405 [local] asgprod:4d938288.3845 LOG:  process 14405 still waiting for ExclusiveLock on extension of relation 470273 of database 16384 after 5001.894 ms
> [ 2011-03-30 15:54:55.886 EDT ] 14405 [local] asgprod:4d938288.3845 CONTEXT:  COPY reportvalues_part_1931, line 1: "660250      41977959        11917   584573.43642105709"
> [ 2011-03-30 15:54:55.886 EDT ] 14405 [local] asgprod:4d938288.3845 STATEMENT:  COPY reportvalues_part_1931 FROM stdin USING DELIMITERS '       '
> [ 2011-03-30 15:54:56.015 EDT ] 7294 [local] asgprod:4d938939.1c7e LOG:  process 7294 still waiting for ExclusiveLock on extension of relation 470606 of database 16384 after 5062.968 ms
> [ 2011-03-30 15:54:56.015 EDT ] 7294 [local] asgprod:4d938939.1c7e CONTEXT:  COPY reportvalues_part_1932, line 158: "660729     41998839        887     45000.0"
> [ 2011-03-30 15:54:56.015 EDT ] 7294 [local] asgprod:4d938939.1c7e STATEMENT:  COPY reportvalues_part_1932 FROM stdin USING DELIMITERS '        '
> [ 2011-03-30 15:54:56.077 EDT ] 25781 [local] asgprod:4d938556.64b5 LOG:  process 25781 still waiting for ExclusiveLock on extension of relation 470606 of database 16384 after 5124.463 ms
>

But you are using stdin for COPY! The best way is use files. Maybe you must
review postgresql.conf configuration, especially the WAL configuration.
How many times you do this procedure? which is the amount of data involved?

--
--
              Emanuel Calvo
              Helpame.com

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Bob Lunney 2011-03-31 14:54:25 Re: Slow deleting tables with foreign keys
Previous Message Jeremy Palmer 2011-03-31 02:16:29 Slow deleting tables with foreign keys