Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TtMUN-0001Wu-6k for pgsql-performance@arkaria.postgresql.org; Thu, 10 Jan 2013 18:04:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TtMUM-0001mk-JO for pgsql-performance@arkaria.postgresql.org; Thu, 10 Jan 2013 18:04:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TtMUL-0001me-Su for pgsql-performance@postgresql.org; Thu, 10 Jan 2013 18:04:25 +0000 Received: from hm1481-31.locaweb.com.br ([201.76.49.243]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TtMUI-0004Xo-KM for pgsql-performance@postgresql.org; Thu, 10 Jan 2013 18:04:25 +0000 Received: from mcbain0006.email.locaweb.com.br (189.126.112.72) by hm1481-10.locaweb.com.br (PowerMTA(TM) v3.5r13) id hts1ac0nvas9 for ; Thu, 10 Jan 2013 16:04:19 -0200 (envelope-from ) Received: from bart0078.correio.biz (bart0078.correio.biz [200.234.210.10]) by mcbain0006.email.locaweb.com.br (Postfix) with ESMTP id 49DF934006A for ; Thu, 10 Jan 2013 16:04:19 -0200 (BRST) X-LocaWeb-COR: locaweb_2009_x-mail Received: from [192.168.9.1] (unknown [177.98.67.158]) (Authenticated sender: postgresql@vorio.com.br) by bart0078.correio.biz (Postfix) with ESMTPSA id 263921E80099 for ; Thu, 10 Jan 2013 16:04:19 -0200 (BRST) Message-ID: <50EF0292.4000605@vorio.com.br> Date: Thu, 10 Jan 2013 16:04:02 -0200 From: PostgreSQL User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Updates on one row causing ExclusiveLock on PostgreSQL 8.3.5 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.3 at mcbain0006 X-Virus-Status: Clean X-CMAE-Score: 0 X-CMAE-Analysis: v=2.0 cv=XZM+OvF5 c=1 sm=1 a=ybwjSUtpdrvcwcwRkuuYHw==:17 a=jl2ymW9NZSsA:10 a=nsr0crgZWZoA:10 a=8nJEP1OIZ-IA:10 a=y6854WlnAAAA:8 a=oGg8BOWVxLsA:10 a=IhCsx3YMXc19sf6lPegA:9 a=wPNLvfGTeEIA:10 a=ybwjSUtpdrvcwcwRkuuYHw==:117 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org My best regards for all... Please. I need for an advice. I'm having a trouble, that puting others queries in wait state, becouse of ExclusiveLock granted by an Update that only update one row at each time. This update occurs into a function and this function are executed several times and concurrently. Below, query plan (explain): Nested Loop (cost=16.91..36.32 rows=1 width=75) -> HashAggregate (cost=16.91..16.92 rows=1 width=4) -> Index Scan using unq_customer_idx_msisdn on customer (cost=0.00..16.90 rows=1 width=4) Index Cond: ((msisdn)::text = '558796013980'::text) -> Index Scan using pk_customer_rel_channel on customer_rel_channel (cost=0.00..19.39 rows=1 width=75) Index Cond: ((customer_rel_channel.id_customer = customer.id_customer) AND (customer_rel_channel.id_channel = 282)) But, the pg_locs shows: PID Relation User Transaction Access Mode Granted Query Start Query 22569 customer_rel_channel postgres ExclusiveLock False 2013-01-10 15:54:09.308056-02 UPDATE news.customer_rel_channel SET status = $1, source = $2 WHERE news.customer_rel_channel.id_channel = $3 AND news.customer_rel_channel.id_customer IN (SELECT id_customer FROM public.customer WHERE public.customer.msisdn = $4) -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance